hello I don't know how to solve a problem:

P= x^3+x^2+Ax+1

at A the value of P is a rational number for any x that satisfies the equation x^2+2x-2=0, and in this case P=B

They ask me to find A and B

I do have the answer, but what I need is to show me the method.

Thank you very much!