-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: replace node-oauth with openid-client #1698
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/nextauthjs/next-auth/GisAQuwZvX71DZj5zDfs8ui3U9HJ |
Conflicts: app/pages/api/auth/[...nextauth].js package-lock.json package.json pages/api/auth/[...nextauth].js src/providers/bungie.js src/providers/google.js src/providers/mailru.js src/providers/vk.js src/providers/yandex.js src/server/index.d.ts src/server/lib/oauth/callback.js src/server/lib/oauth/client.js src/server/lib/signin/oauth.js www/docs/configuration/pages.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
* chore(deps): add openid-client * chore: merge in next * refactor(provider): remove redundant requestUrl param * feat(provider): make profile callback optional * refactor: use openid-client for OAuth2/OIDC * refactor: use openidClient in oauth signin handler * refactor: use openidClient in oauth callback handler * docs(warn): add async issuer/old config warnings * chore(deps): remove jsonwebtoken * chore: add issuer property for testing locally * chore(dev): import providers one-by-one * fix(oauth): handle when no user in body/query * chore(deps): remove pkce-challenge * chore(dev): change Auth0 protection * refactor(oauth): simplify pkce/state * refactor: split OAuth1 client, reduce openid client will improve API in another PR * chore: change comment, dev app * chore: mention OIDC client config discovery * fix: add new operator when creating OIDC client * refactor: delete req.query.nextauth after use * docs(ts): use `TokenSet` from `openid-client` * chore: simplify/type signin route * refactor: rename to client-legacy to indicate intnet of maintenance * chore(deps): try setting `oauth` as optional peer dep * chore(deps): add `oauth` back as regular dependency * chore(deps): add @types/oauth as dev dependency * chore: remove params kept for backwards compatibility * chore: don't make breaking changes in this PR * chore(core): use correct TS declarations * refactor: move files/add more accurate types internally * chore: remove TODO comment * chore: catch all errors in authorization URL generation
Continuation of #1105
We rely on a package that hasn't been updated in a very long time. We kind of depend on it even after this, as our new dependency doesn't support OAuth 1.0 anymore, but we will treat it as a legacy solution and will only provide minimal maintenance to it. There are a few bigger providers still using the old spec like Twitter, but new providers will hopefully rather rely on newer specs.
Our new choice
openid-client
is maintained properly by awesome people, and will help us with PKCE, state and other things that until now we had to do manually.Checklist:
- [ ] decide on new provider API (RFC: Improve OAuth provider configuration #1846)will address in another PR- [ ] add migration to docswill address in another PRRelated issues:
Closes #1048, closes #1305