@@ -1086,6 +1086,41 @@ export class CoreLoginHelperProvider {
10861086 } ) ;
10871087 }
10881088 } else {
1089+ if ( currentSite . isOAuth ( ) ) {
1090+ // User authenticated using an OAuth method. Check if it's still valid.
1091+ const identityProviders = this . getValidIdentityProviders ( result . config ) ;
1092+ const providerToUse = identityProviders . find ( ( provider ) => {
1093+ const params = this . urlUtils . extractUrlParams ( provider . url ) ;
1094+
1095+ return params . id == currentSite . getOAuthId ( ) ;
1096+ } ) ;
1097+
1098+ if ( providerToUse ) {
1099+ if ( ! this . appProvider . isSSOAuthenticationOngoing ( ) && ! this . isSSOConfirmShown && ! this . waitingForBrowser ) {
1100+ // Open browser to perform the OAuth.
1101+ this . isSSOConfirmShown = true ;
1102+
1103+ const confirmMessage = this . translate . instant ( 'core.login.' +
1104+ ( currentSite . isLoggedOut ( ) ? 'loggedoutssodescription' : 'reconnectssodescription' ) ) ;
1105+
1106+ this . domUtils . showConfirm ( confirmMessage ) . then ( ( ) => {
1107+ this . waitingForBrowser = true ;
1108+ this . sitesProvider . unsetCurrentSite ( ) ; // Unset current site to make authentication work fine.
1109+
1110+ this . openBrowserForOAuthLogin ( siteUrl , providerToUse , result . config . launchurl , data . pageName ,
1111+ data . params ) ;
1112+ } ) . catch ( ( ) => {
1113+ // User cancelled, logout him.
1114+ this . sitesProvider . logout ( ) ;
1115+ } ) . finally ( ( ) => {
1116+ this . isSSOConfirmShown = false ;
1117+ } ) ;
1118+ }
1119+
1120+ return ;
1121+ }
1122+ }
1123+
10891124 const info = currentSite . getInfo ( ) ;
10901125 if ( typeof info != 'undefined' && typeof info . username != 'undefined' ) {
10911126 const rootNavCtrl = this . appProvider . getRootNavController ( ) ,
0 commit comments