When I was doing third-party login, I encountered a problem. I wanted to prevent CSRF attacks, and then I added a piece of code like this
Then I am in the callback function. Now I can see that $_GET['state'] can be read, but $state is NULL, and then I wonder if it is not stored. Go in, then I go to write in the first picture and then read. It is worth it at this time.
The error message is an error message thrown by myself in my program, but it is the error here.
Have you encountered this problem? How to solve this problem? I feel like it is a problem with my server configuration? If you are not sure, please ask God for answers.
Screenshot of page throwing error:
迷茫2017-05-27 17:45:43
I have done this before, you can comment out the if judgment. This is one way.
Another way is to take a look at the state generation method. It is a bit like a verification code. You can save the database or session after the state is generated, and then add the state parameters when generating the callback. The value during verification is also the same. Get the database or session to determine the state parameter in the callback.