Solutions of $x^2+3y^2=p$ for $p$ prime [duplicate]

$$x^2+3y^2=p \; \;$$ for $$p$$ prime greater than $$3$$ has a solution if and only if $$p\equiv 1\pmod 3$$

I am supposed to use the fact that the class number of $$\mathbb Q(\sqrt-3)$$ is 1.

I already got the first direction.

Would appreciate it if anyone could point me to the right answer (hints) for the 2nd direction

Since $$p$$ is stipulated to be a prime number in $$\mathbb Z$$ greater than 3, we know that $$p \not \equiv 0 \pmod 3$$. Therefore $$p \equiv 1$$ or $$2 \pmod 3$$. Clearly $$3y^2 \equiv 0 \pmod 3$$, so we can ignore $$y$$ for the time being.
Then we need $$x$$ to be coprime to 3. If $$x \equiv 1 \pmod 3$$, then $$x^2 \equiv 1 \pmod 3$$ also. But if $$x \equiv 2 \pmod 3$$, then $$x^2 \equiv 1 \pmod 3$$ anyway.
For example, $$x^2 + 3y^2 = 5$$ has no solutions in integers. But $$x^2 + 3y^2 = 7$$ does, e.g., $$x = -2$$, $$y = 1$$.