Quadratic reciprocity problem

Iīm stuck with this problem, whose goal is to prove that (-2|p)=1 (i.e: -2 is a quadratic residue modulo p) if p=1,3 (mod 8).

first part is to prove it for p=1 (mod 8) and they tell me to use the following factorization (thatīs the only hint for the exercise):

((x^8k)-1)=(((x^2k)-1)^2)+2(x^2k))((x^4k)-1) (if you write it in paper this factorization becomes pretty clear)

Iīm aware that I have to use Eulerīs Criterion: (a|p)=1 if and only if

(a)^(p-1/2)=1 (mod p), but I donīt know how.

I will appreciate any kind of help

thank you