As this has class number one there are many approaches. Solve
$$ \beta^2 \equiv -8 \pmod p. $$ If your $\beta$ is odd, replace by $p-\beta$ which is even, anyway call it $b.$ Now you have
$$ b^2 \equiv -8 \pmod {4p} $$ with $b$ even, or
$$ b^2 - 4pt = -8. $$
So, the binary quadratic form
$$ \langle p,b,t \rangle $$ or
$$ f(x,y) = p x^2 + b x y + t y^2 $$ has discriminant $-8.$ Gauss reduce this, the result is $$ \langle 1,0,2 \rangle $$ because that is the only reduced form for that discriminant.
ALMOST DONE
So, reduction: there is a 2 by 2 matrix with determinant 1, write it as
$$ P = \;
\left( \begin{array}{rr}
\alpha & \beta \\
\gamma & \delta
\end{array}
\right), $$
also name
$$ M = \;
\left( \begin{array}{rr}
p & b/2 \\
b/2 & t
\end{array}
\right), $$
and
$$ R = \;
\left( \begin{array}{rr}
1 & 0 \\
0 & 2
\end{array}
\right). $$
The relationship found by doing reduction step by step is
$$ P^T M P = R. $$
Let $Q = P^{-1}.$ Then
$$ Q^T R Q = M. $$
The left-hand column of $Q$ gives the representation of your original prime $p.$ Multiply it out.