From $AB=2$ we know $A$ and $B$ have the same sign.
Moreover, if we find a solution for some values $A=A_1$ and $B=B_1$,
then $A=-A_1$ and $B=-B_1$ also is a solution.
So we can assume initially that $A$ and $B$ are both positive,
find all such solutions, and then simply change signs to produce all the remaining solutions (the ones in which $A$ and $B$ are both negative).
Similarly, we can assume initially that $A\geq B$, because all the solutions
in which $B \geq A$ can then be produced just by swapping the values of
the two variables.
So we now have (with these assumptions) $A \geq B > 0,$
$A^2 + B^2 = 5,$ and $AB = 2.$ Then
\begin{align}
(A + B)^2 &= A^2 + 2AB + B^2 = 5 + 2(2) = 9, \\
(A - B)^2 &= A^2 - 2AB + B^2 = 5 - 2(2) = 1. \\
\end{align}
In each of these equations, the positive square roots of both sides
must be equal, and since $A+B>0$ and $A-B\geq0$ this tells us that
\begin{align}
A + B &= 3, \\
A - B &= 1. \\
\end{align}
Therefore (adding the two equations) $2A = 4,$ so $A = 2,$ so $B = 1.$
That is, the unique solution (under the assumption $A\geq B>0$)
is $(A,B) = (2,1).$
We can now remove the assumptions that $A\geq B$ and that $B>0,$
then use the facts mentioned earlier to derive the remaining solutions:
$(A,B) = (1,2)$ (swapping values), $(A,B) = (-2,-1)$
or $(A,B) = (-1,-2)$ (changing signs).