Skip to content

Commit

Permalink
fix: only warn when using Twitter + OAuth 2.0 (#4003)
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Feb 18, 2022
1 parent 692fafe commit fb8874d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/next-auth/src/core/lib/assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ export function assertConfig(
if (!req.host) return "NEXTAUTH_URL"

let hasCredentials, hasEmail
let hasTwitterProvider
let hasTwitterOAuth2

for (const provider of options.providers) {
if (provider.type === "credentials") hasCredentials = true
else if (provider.type === "email") hasEmail = true
else if (provider.id === "twitter") hasTwitterProvider = true
else if (provider.id === "twitter" && provider.version === "2.0")
hasTwitterOAuth2 = true
}

if (hasCredentials) {
Expand Down Expand Up @@ -80,7 +81,7 @@ export function assertConfig(
return new MissingAdapter("E-mail login requires an adapter.")
}

if (!twitterWarned && hasTwitterProvider) {
if (!twitterWarned && hasTwitterOAuth2) {
twitterWarned = true
return "TWITTER_OAUTH_2_BETA"
}
Expand Down

0 comments on commit fb8874d

Please sign in to comment.