@@ -59,21 +59,25 @@ router.post('/signin/local', (req, res) => {
59
59
} ) ;
60
60
61
61
62
- router . get ( '/signin/google' , passport . authenticate ( "google" , { scope : [ "profile" , "email" ] } ) ) ;
62
+ router . get ( '/signin/google' , ( req , res , next ) => {
63
+ passport . authenticate ( "google" , { scope : [ "profile" , "email" ] , state : req . query . app } ) ( req , res , next ) ;
64
+ } ) ;
63
65
64
66
router . get ( '/signin/google/callback' , passport . authenticate ( "google" , { failureRedirect : "/login" , session : false } ) ,
65
67
function ( req , res ) {
66
68
let token = req . user . token ;
67
- res . redirect ( config . hostUI + `${ config . portUI ? `:${ config . portUI } ` : `` } ` + "/#/login?token=" + token ) ;
69
+ res . redirect ( config . hostUI + `${ config . portUI ? `:${ config . portUI } ` : `` } ` + ` ${ req . query . state ? `/ ${ req . query . state } ` : `` } ` + "/#/login?token=" + token ) ;
68
70
}
69
71
) ;
70
72
71
- router . get ( '/signin/microsoft' , passport . authenticate ( "microsoft" , { scope : [ "https://graph.microsoft.com/user.read openid" ] } ) ) ;
73
+ router . get ( '/signin/microsoft' , ( req , res , next ) => {
74
+ passport . authenticate ( "microsoft" , { scope : [ "https://graph.microsoft.com/user.read openid" ] , state : req . query . app } ) ( req , res , next ) ;
75
+ } ) ;
72
76
73
77
router . get ( '/signin/microsoft/callback' , passport . authenticate ( "microsoft" , { failureRedirect : "/login" , session : false } ) ,
74
78
function ( req , res ) {
75
79
let token = req . user . token ;
76
- res . redirect ( config . hostUI + `${ config . portUI ? `:${ config . portUI } ` : `` } ` + "/#/login?token=" + token ) ;
80
+ res . redirect ( config . hostUI + `${ config . portUI ? `:${ config . portUI } ` : `` } ` + ` ${ req . query . state ? `/ ${ req . query . state } ` : `` } ` + "/#/login?token=" + token ) ;
77
81
}
78
82
) ;
79
83
0 commit comments