nuxt-auth: auth.origin setting in nuxt.config.ts is not working with next-auth@4.22
Environment
- Operating System:
Darwin
- Node Version:
v16.14.0
- Nuxt Version:
3.2.3
- Nitro Version:
2.2.3
- Package Manager:
yarn@1.22.19
- Builder:
vite
- User Config:
runtimeConfig
,app
,vite
,modules
,auth
,dayjs
,i18n
- Runtime Modules:
@nathanchase/nuxt-dayjs-module@1.0.11
,@nuxtjs/i18n@8.0.0-beta.10
,@sidebase/nuxt-auth@0.5.0
,formidable@3.2.5
- Build Modules:
-
Reproduction
No response
Describe the bug
After installing next-auth@4.22 and using GoogleProvider in /api/auth/[…].ts, there will be a warning message when starts up:
[next-auth][warn][NEXTAUTH_URL] https://next-auth.js.org/warnings#nextauth_url
And when using SignIn() in custom login page, Google will redirect me to the error page “redirect_uri_mismatch”. It also finds the http request to Google carries redirect_uri: http://localhost:3000/api/auth/callback/google, even the auth.origin is set in nuxt.config.ts.
Additional context
No response
Logs
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 9
- Comments: 15 (2 by maintainers)
@WhatzzUp I have it working on prod currently, my nuxt config is as follows:
Edit: I am using version
"@sidebase/nuxt-auth": "^0.6.0-beta.3",
Then in my ‘/auth/[…].ts’ I have the following:
And finally in my .env file
Hope it helps!
Same problem, if you go back to version “@sidebase/nuxt-auth”: “^0.5.0”, the problem still remains
Hey everyone!
As a quick workaround you can export
NEXTAUTH_URL
! Right now my time is sadly quite limited. If you just want to use the next-auth / auth.js provider I suggest to use 0.5 until 0.6 has become stable, thanks!origin settings is also not typechecked with 0.6.0.alpha.2, something wrong with the settings defined I suppose