lspil / full_stack_oauth2

58 stars 40 forks source link

Changing the redirect_uri to localhost:3000 instead of 127.0.0.1:3000 #5

Open pezhmantp opened 1 year ago

pezhmantp commented 1 year ago

Dear Mr. Spilca thank you so much for the very useful tutorials you make on youtube. The unreasonable problem of the "code_verifier" being null, originates from the address of the "redirect_uri". If you notice, when the authorization code is sent back to the browser, the "redirect_uri" which is called is 127.0.0.1:3000, while the react project runs on localhost:3000 and the content of the "sessionStorage" are not accessible at the 127.0.0.1:3000 rather are accessible at localhost:3000. That's why we get an "code_verifier" with a null value. To solve this strange and unreasonable problem, change the "redirect_uri" to localhost:3000 at the both back-end and front-end. And to avoid CORS errors, add the both addresses(127.0.0.1:3000 and localhost:3000) to the CORS configuration.