Theorem: Let $d,d'>1$ be square-free integers. Then $\mathbb{Q}(\sqrt{d})$ and $\mathbb{Q}(\sqrt{d'})$ are isomorphic as fields of and only if $d=d'$.
In this question I saw the following proof:
Suppose $d$ and $d'$ are both squarefree integers, both different from $1$, and consider $F_1 = \mathbb{Q}(\sqrt{d})$ and $F_2 = \mathbb{Q}(\sqrt{d'})$.
They are never isomorphic as fields; clearly, $d$ is a square in $F_1$. I claim $d$ can only be a square in $F_2$ if $d=d'$. Indeed, if$(x+y\sqrt{d'})^2 = d$. That means that $x^2 + d'y^2 + 2xy\sqrt{d'} = d$, hence $2xy = 0$ and $x^2+d'y^2=d$. If $x=0$, then $d=d'y^2$, so clearing denominators you get $da^2 = d'b^2$ for some $a,b\in\mathbb{Z}$, $\gcd(a,b)=1$; since both $d$ and $d'$ are squarefree, it follows that $|a|=|b|=1$, so $d=d'$. If $y=0$, then $d=x^2$, so $d$ is the square of a rational, contradicting the fact that it is a squarefree integer different from $1$. Thus, of $d$ is a square in $F_2$, then $d=d'$. Hence, if $F_1\cong F_2$, then $d=d'$ (converse is immediate).
I don't understand this step: "since both $d$ and $d'$ are squarefree, it follows that $|a|=|b|=1$". Why is that true?