At the end of a proof on the Stacks project showing that the union of disjoint open affines is affine, we have the following statement
By assumption the morphism $X \rightarrow \operatorname{Spec}(X)$ induces an isomorphism of $\operatorname{Spec}(\mathcal{O}_X(U))$ with $U$ and similarly for $V$. Hence $X \rightarrow \operatorname{Spec}(R)$ is an isomorphism.
Why is there an induced isomorphism (i.e. why is it an isomorphism, not just a morphism)? What is the induced isomorphism?
As an aside, the proof on the Stacks project uses the fact that the $\operatorname{Spec}$ of a product is a coproduct of $\operatorname{Spec}$, so why not use a one line proof à la this proof?
The morphism $U \to \operatorname{Spec}(\mathcal O_X(U))$ is the one obtained by restricting the morphism $X \to \operatorname{Spec}(\mathcal O_X(X))$ to $U$.
That this is an isomorphism follows from the fact that $U$ is affine: suppose $U\cong \operatorname{Spec}(S)$; then, it is a standard result that $\mathcal{O}_X(U) \cong S$.