File tree 5 files changed +16
-4
lines changed 5 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ export const appleOAuth = OAuth2Plugin({
85
85
throw error ;
86
86
}
87
87
} ,
88
- successRedirect : ( req ) => {
88
+ successRedirect : ( req : PayloadRequest , token ?: string ) => {
89
89
// Check user roles to determine redirect
90
90
const user = req . user ;
91
91
if ( user && Array . isArray ( user . roles ) ) {
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ export const googleOAuth = OAuth2Plugin({
59
59
60
60
return token ;
61
61
} ,
62
- successRedirect : ( req ) => {
62
+ successRedirect : ( req : PayloadRequest , accessToken ?: string ) => {
63
63
return "/admin" ;
64
64
} ,
65
65
failureRedirect : ( req , err ) => {
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ export const zitadelOAuth = OAuth2Plugin({
63
63
64
64
return token ;
65
65
} ,
66
- successRedirect : ( req ) => {
66
+ successRedirect : ( req : PayloadRequest , token ?: string ) => {
67
67
return "/admin" ;
68
68
} ,
69
69
failureRedirect : ( req , err ) => {
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ export const createAuthorizeEndpoint = (
11
11
const authCollection = pluginOptions . authCollection || "users" ;
12
12
const callbackPath = pluginOptions . callbackPath || "/oauth/callback" ;
13
13
const redirectUri = `${ pluginOptions . serverURL } /api/${ authCollection } ${ callbackPath } ` ;
14
- const scope = pluginOptions . scopes . join ( " " ) ;
15
14
15
+ const scope = pluginOptions . scopes . join ( " " ) ;
16
16
const responseType = "code" ;
17
17
const accessType = "offline" ;
18
18
@@ -30,6 +30,9 @@ export const createAuthorizeEndpoint = (
30
30
if ( pluginOptions . responseMode ) {
31
31
url . searchParams . append ( "response_mode" , pluginOptions . responseMode ) ;
32
32
}
33
+ if ( pluginOptions . authType ) {
34
+ url . searchParams . append ( "auth_type" , pluginOptions . authType ) ;
35
+ }
33
36
34
37
return Response . redirect ( url . toString ( ) ) ;
35
38
} ,
Original file line number Diff line number Diff line change @@ -139,6 +139,14 @@ export interface PluginTypes {
139
139
*/
140
140
prompt ?: string ;
141
141
142
+ /**
143
+ * Authentication type for the OAuth provider.
144
+ * This is used by Facebook to specify the behavior of login flow.
145
+ * Reference: https://developers.facebook.com/docs/facebook-login/guides/advanced/re-authentication/
146
+ * Possible values are "reauthenticate" and "rerequest".
147
+ */
148
+ authType ?: string ;
149
+
142
150
/**
143
151
* Path to the callback endpoint.
144
152
* Must start with a forward slash.
@@ -165,6 +173,7 @@ export interface PluginTypes {
165
173
* @deprecated Use the two-parameter overload instead
166
174
*/
167
175
successRedirect ( req : PayloadRequest ) : string | Promise < string > ;
176
+
168
177
/**
169
178
* Redirect users after successful login.
170
179
* @param req PayloadRequest object
You can’t perform that action at this time.
0 commit comments