I'm reading Jarod Alper's notes on stacks and moduli and I'm stuck on the problem in the title. Let me give his definition of a principal $G$-bundle.
Def: Let $G\to S$ be a flat group scheme locally of finite presentation. A principal $G$-bundle over an $S$-scheme $X$ is a flat locally finitely presented morphism $P\to X$ with a $G$-action via $\sigma:G\times_SP\to P$ such that $P\to X$ is $G$-invariant and $$(\sigma,p_2):G\times_SP\to P\times_XP:(g,p)\mapsto(gp,p)$$ is an isomorphism.
Morphisms of principal $G$-bundles are $G$-equivariant morphisms of schemes.
So say I have two principal $G$-bundles $P\to X$ and $P'\to X$ and a $G$-equivariant map $\varphi:P\to P'$, i.e. $\varphi(gp) = g\varphi(p)$, so that $(\sigma',p_2)\circ(\operatorname{id}_G,\varphi) = (\varphi,\varphi)\circ(\sigma,p_2)$ so that $$(\varphi,\varphi) = (\sigma',p_2)\circ(\operatorname{id}_G,\varphi) \circ(\sigma,p_2)^{-1}$$ I feel like this is close, but I'm not sure how to conclude. I haven't used $G$-invariance of the structure maps $P,P'\to X$. There is also no local-triviality condition in the definition, making me think that the proof should be "purely formal".
The previous exercise shows that $P\to X$ is a principal $G$-bundle over $X\to S$ if and only if $P\to X$ is a principal $G\times_SX$-bundle over $X\to X$. Thus by base change, we can assume $X = S$ and we have $(\sigma,p_2):G\times_XP\to P\times_XP$ is an isomorphism, and the same equation as above holds. Comparing "coordinate-wise", does this imply $\varphi = \sigma'\circ\sigma^{-1}$?