File tree Expand file tree Collapse file tree 3 files changed +12
-11
lines changed Expand file tree Collapse file tree 3 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -45,11 +45,13 @@ export function assertConfig(
4545 if ( ! req . host ) return "NEXTAUTH_URL"
4646
4747 let hasCredentials , hasEmail
48+ let hasTwitterProvider
4849
49- options . providers . forEach ( ( { type } ) => {
50- if ( type === "credentials" ) hasCredentials = true
51- else if ( type === "email" ) hasEmail = true
52- } )
50+ for ( const provider of options . providers ) {
51+ if ( provider . type === "credentials" ) hasCredentials = true
52+ else if ( provider . type === "email" ) hasEmail = true
53+ else if ( provider . id === "twitter" ) hasTwitterProvider = true
54+ }
5355
5456 if ( hasCredentials ) {
5557 const dbStrategy = options . session ?. strategy === "database"
@@ -75,4 +77,8 @@ export function assertConfig(
7577 if ( hasEmail && ! options . adapter ) {
7678 return new MissingAdapter ( "E-mail login requires an adapter." )
7779 }
80+
81+ if ( hasTwitterProvider ) {
82+ return "TWITTER_OAUTH_2_BETA"
83+ }
7884}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ function hasErrorProperty(
1919 return ! ! ( x as any ) ?. error
2020}
2121
22- export type WarningCode = "NEXTAUTH_URL" | "NO_SECRET"
22+ export type WarningCode = "NEXTAUTH_URL" | "NO_SECRET" | "TWITTER_OAUTH_2_BETA"
2323
2424/**
2525 * Override any of the methods, and the rest will use the default logger.
Original file line number Diff line number Diff line change @@ -166,15 +166,10 @@ export interface TwitterProfile {
166166 }
167167}
168168
169- let warned = false
170169export default function Twitter <
171170 P extends Record < string , any > = TwitterLegacyProfile | TwitterProfile
172171> ( options : OAuthUserConfig < P > ) : OAuthConfig < P > {
173- if ( ! warned && options . version === "2.0" ) {
174- warned = true
175- console . warn (
176- "Opted-in to Twitter OAuth 2.0. See the docs https://next-auth.js.org/providers/twitter#oauth-2"
177- )
172+ if ( options . version === "2.0" ) {
178173 return {
179174 id : "twitter" ,
180175 name : "Twitter" ,
You can’t perform that action at this time.
0 commit comments