File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,20 +93,22 @@ OAuth.loadStrategies = async (strategies) => {
9393 if ( ! [ id , displayName , email ] . every ( Boolean ) ) {
9494 return done ( new Error ( 'insufficient-scope' ) ) ;
9595 }
96-
97- const user = await OAuth . login ( {
98- name,
99- oAuthid : id ,
100- handle : displayName ,
101- email,
102- } ) ;
103-
104- winston . verbose ( `[plugin/sso-oauth2-multiple] Successful login to uid ${ user . uid } via ${ name } (remote id ${ id } )` ) ;
105- authenticationController . onSuccessfulLogin ( req , user . uid ) ;
106- OAuth . assignGroups ( { provider : name , user, profile } ) ;
107- done ( null , user ) ;
108-
109- plugins . hooks . fire ( 'action:oauth2.login' , { name, user, profile } ) ;
96+ try {
97+ const user = await OAuth . login ( {
98+ name,
99+ oAuthid : id ,
100+ handle : displayName ,
101+ email,
102+ } ) ;
103+ winston . verbose ( `[plugin/sso-oauth2-multiple] Successful login to uid ${ user . uid } via ${ name } (remote id ${ id } )` ) ;
104+ await authenticationController . onSuccessfulLogin ( req , user . uid ) ;
105+ await OAuth . assignGroups ( { provider : name , user, profile } ) ;
106+ done ( null , user ) ;
107+
108+ plugins . hooks . fire ( 'action:oauth2.login' , { name, user, profile } ) ;
109+ } catch ( err ) {
110+ done ( err ) ;
111+ }
110112 } ) ) ;
111113
112114 configs . forEach ( ( strategy , idx ) => {
You can’t perform that action at this time.
0 commit comments