next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

Add callbackUrl option to OAuth provider config

Open jclem opened this issue 3 years ago โ€ข 1 comments

โ˜•๏ธ Reasoning

This adds a callbackUrl option to OAuth provider configuration.

Currently, the OAuth callback URL is inferred from the host from which a user is attempting to sign in. This is problematic for situations like those encountered when using preview deployments on Vercel. If one can't use wildcard characters in a provider's callback URL config, or if one can't create new callback URLs via an API, new callback URLs must be added in a provider's UI for every single preview deployment.

This can be worked around by using a middleman proxy app. So, I could set my callback URL to https://www.authproxy.dev/redirect, and tell Authproxy to redirect to my preview deployment URL which is much easier than setting a new callback URL in an OAuth provider's developer portal.

With this PR, I can set callbackUrl to Authproxy (or a similar service) and remove a great deal of tedium from working with OAuth providers and Vercel preview deployments.

๐Ÿงข Checklist

  • [x] Documentation The documentation on callback URLs is a bit confusing (because the term is used to mean two different things in different places), so I could use some help determining whether new documentation is needed here.
  • [x] Tests As far as I can tell, there are none for this sort of option
  • [x] Ready to be merged

๐ŸŽซ Affected issues

Please scout and link issues that might be solved by this PR.

Fixes: INSERT_ISSUE_LINK_HERE

๐Ÿ“Œ Resources

jclem avatar Sep 17 '22 23:09 jclem

The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

Name Status Preview Comments Updated
auth-docs โŒ Failed (Inspect) Jan 27, 2023 at 4:02AM (UTC)
next-auth-docs ๐Ÿ”„ Building (Inspect) Jan 27, 2023 at 4:02AM (UTC)
1 Ignored Deployment
Name Status Preview Comments Updated
next-auth โฌœ๏ธ Ignored (Inspect) Jan 27, 2023 at 4:02AM (UTC)

vercel[bot] avatar Sep 17 '22 23:09 vercel[bot]

Hi @jclem I moved the changes under /core in a new PR & will add you as co-author when merge, let's continue here ๐Ÿ™Œ

ThangHuuVu avatar Jan 27 '23 04:01 ThangHuuVu