File tree Expand file tree Collapse file tree 5 files changed +16
-4
lines changed
Expand file tree Collapse file tree 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({
8585 throw error ;
8686 }
8787 } ,
88- successRedirect : ( req ) => {
88+ successRedirect : ( req : PayloadRequest , token ?: string ) => {
8989 // Check user roles to determine redirect
9090 const user = req . user ;
9191 if ( user && Array . isArray ( user . roles ) ) {
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ export const googleOAuth = OAuth2Plugin({
5959
6060 return token ;
6161 } ,
62- successRedirect : ( req ) => {
62+ successRedirect : ( req : PayloadRequest , accessToken ?: string ) => {
6363 return "/admin" ;
6464 } ,
6565 failureRedirect : ( req , err ) => {
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ export const zitadelOAuth = OAuth2Plugin({
6363
6464 return token ;
6565 } ,
66- successRedirect : ( req ) => {
66+ successRedirect : ( req : PayloadRequest , token ?: string ) => {
6767 return "/admin" ;
6868 } ,
6969 failureRedirect : ( req , err ) => {
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ export const createAuthorizeEndpoint = (
1111 const authCollection = pluginOptions . authCollection || "users" ;
1212 const callbackPath = pluginOptions . callbackPath || "/oauth/callback" ;
1313 const redirectUri = `${ pluginOptions . serverURL } /api/${ authCollection } ${ callbackPath } ` ;
14- const scope = pluginOptions . scopes . join ( " " ) ;
1514
15+ const scope = pluginOptions . scopes . join ( " " ) ;
1616 const responseType = "code" ;
1717 const accessType = "offline" ;
1818
@@ -30,6 +30,9 @@ export const createAuthorizeEndpoint = (
3030 if ( pluginOptions . responseMode ) {
3131 url . searchParams . append ( "response_mode" , pluginOptions . responseMode ) ;
3232 }
33+ if ( pluginOptions . authType ) {
34+ url . searchParams . append ( "auth_type" , pluginOptions . authType ) ;
35+ }
3336
3437 return Response . redirect ( url . toString ( ) ) ;
3538 } ,
Original file line number Diff line number Diff line change @@ -139,6 +139,14 @@ export interface PluginTypes {
139139 */
140140 prompt ?: string ;
141141
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+
142150 /**
143151 * Path to the callback endpoint.
144152 * Must start with a forward slash.
@@ -165,6 +173,7 @@ export interface PluginTypes {
165173 * @deprecated Use the two-parameter overload instead
166174 */
167175 successRedirect ( req : PayloadRequest ) : string | Promise < string > ;
176+
168177 /**
169178 * Redirect users after successful login.
170179 * @param req PayloadRequest object
You can’t perform that action at this time.
0 commit comments