[step:Recover coprime parameters with odd positive denominator]
Since the solution is primitive, $x$ and $z$ cannot both be even. From
\begin{align*}
z^2-x^2=2y^2
\end{align*}
we see that $x$ and $z$ have the same parity, so both are odd. Reducing the original equation modulo $2$ then gives $y^2\equiv 0\pmod{2}$, hence $y$ is even.
Define integers $A,B\in\mathbb{Z}$ by
\begin{align*}
A=\frac{x+z}{2},\qquad B=\frac{z-x}{2}.
\end{align*}
Then $A+B=z$ and $A-B=x$. If a prime $p$ divides both $A$ and $B$, then $p$ divides $x$ and $z$. The equation $2y^2=z^2-x^2$ then implies $p\mid 2y^2$. For odd $p$, this gives $p\mid y$, contradicting primitivity. For $p=2$, divisibility of both $A$ and $B$ would make $x=A-B$ and $z=A+B$ even, contradicting that $x$ and $z$ are odd. Hence $\gcd(A,B)=1$.
The identity
\begin{align*}
2AB=2\left(\frac{x+z}{2}\right)\left(\frac{z-x}{2}\right)=\frac{z^2-x^2}{2}=y^2
\end{align*}
shows that $2AB$ is a square. Since $\gcd(A,B)=1$, exactly one of $A$ and $B$ is even: they cannot both be even by coprimality, and they cannot both be odd because then $2AB$ would have $2$-adic valuation $1$, not an even valuation as a square must. Therefore one of $A=(x+z)/2$ and $B=(z-x)/2$ is odd.
If $A$ is odd, keep the current sign of $x$. If $A$ is even, replace $x$ by $-x$; this preserves the equation and interchanges $A$ with $B$. After this sign choice, redeclare
\begin{align*}
X=\frac{x}{z},\qquad Y=\frac{y}{z},\qquad t=\frac{Y}{X+1}=\frac{y}{x+z}.
\end{align*}
The denominator $(x+z)/2$ is odd, and since $y$ is even we may write $y=2y_0$ with $y_0\in\mathbb{Z}$. Thus
\begin{align*}
t=\frac{2y_0}{x+z}=\frac{y_0}{(x+z)/2}.
\end{align*}
Writing this rational number in lowest terms as $t=n/m$, with $m>0$, $n\geq 0$, and $\gcd(m,n)=1$, the reduced denominator $m$ divides the odd integer $(x+z)/2$. Hence $m$ is odd. Since $y>0$, we have $t>0$ and therefore $n>0$ in the present case.
Applying the parametrization from the previous step to this redeclared slope gives
\begin{align*}
X=\frac{m^2-2n^2}{m^2+2n^2},\qquad
Y=\frac{2mn}{m^2+2n^2}.
\end{align*}
Multiplying the formulas for $X=x/z$ and $Y=y/z$ by $z$ gives
\begin{align*}
x=\frac{z(m^2-2n^2)}{m^2+2n^2},\qquad
y=\frac{2zmn}{m^2+2n^2}.
\end{align*}
The parametrized triple
\begin{align*}
(m^2-2n^2,\;2mn,\;m^2+2n^2)
\end{align*}
is primitive by the previous step and has the same rational point $(X,Y)$ as $(x,y,z)$. Since both triples are primitive integer triples with positive third coordinate representing the same rational point, they are equal. Hence
\begin{align*}
x=m^2-2n^2,\qquad y=2mn,\qquad z=m^2+2n^2.
\end{align*}
[/step]