Docker and NextAuth with Google OAuth are not working #5416
Unanswered
datteroandrea
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So I have an authentication system that uses NextAuth and Google OAuth and when using it in development (running on http://localhost:3000) the authentication succedes however at the moment for production purposes I had to deploy the application into a Docker container and using Nginx the server is now reachable via http://localhost however when i try to autenticate now I get the following error:
Looking at the error it appears I should not have correctly set NEXTAUTH_URL as seen here from the previous error log.
However if you take a look at my .env file you will see the following:
As you can see I have correctly set the NEXTAUTH_URL and if I try to change it to http://localhost:3000/ then after signing in I will be redirected to http://localhost:3000/api/auth/signin?csrf=true which does not show anything because the server is now accessible only via http://localhost.
As you may imagine I may have made a mistake in the Google Developer Console, however I can guarantee that I have set both urls in the Google OAuth to http://localhost.
How can I solve this problem?
Beta Was this translation helpful? Give feedback.
All reactions