Please refer to the documentation, the example project and existing issues before creating a new issue.
Your question
A clear and concise question.
Since vercel preview deployment url changes for every preview, how can we set oauth redirect uri for those? They also don't support wildcards. I'm trying to use google as an oauth provider
Documentation feedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.
Since vercel preview deployment url changes for every preview, how can we set oauth redirect uri for those? They also don't support wildcards. I'm trying to use google as an oauth provider
Most OAuth Providers do not support wildcards in callback URLs.
This is very awkward but not something we can do anything about.
Enabling an Email Provider or Credentials Provider on test instances can be helpful to work around this.
Note: If you enable the VERCEL_URL environment variable, NextAuth.js with pick that up if NEXTAUTH_URL is not set.
@iaincollins Thank you! will add an email provider
@iaincollins yes. I think having this feature will be something useful.
Here's my idea.
next-auth, we can consider the main deployment URL as that.But this will be a killer feature, if we can do this inside next-auth.
There will be potential issues with my approach, but if we can do this, this will be an valuable contribution to the community.
And we can stand out from other auth libraries/solutions.
Note: If you enable the VERCEL_URL environment variable, NextAuth.js with pick that up if NEXTAUTH_URL is not set.
@iaincollins Would love your take on the following.
Sort of related to this issue (or perhaps just what I consider to be a broader issue) is that it seems NEXTAUTH_URL cannot be set within next.config.js like other env variables, specifically in the absence of build-time setting (.env file, Vercel UI settings for env)
I consider the API route to be more a runtime concern, so I'm confused why VERCEL_URL and localhost:3000 are the first and second defaults, with no extra runtime check for a NEXTAUTH_URL set later in the _race_ so to speak.
I could be totally missing the rationale here (maybe some quirks related to _serverless_ on Vercel), so apologies in advance if I'm off on the above 馃槄
Just saw this one - https://github.com/nextauthjs/next-auth/issues/497 - sorry if my comment above is a bit of a duplicate.
Most helpful comment
@iaincollins yes. I think having this feature will be something useful.
Here's my idea.
next-auth, we can consider the main deployment URL as that.But this will be a killer feature, if we can do this inside
next-auth.There will be potential issues with my approach, but if we can do this, this will be an valuable contribution to the community.
And we can stand out from other auth libraries/solutions.