Open exhaler opened 3 years ago
Try this:
const urlLogout = https://${environment.tenantName}.b2clogin.com/tfp/${environment.tenantName}.onmicrosoft.com/${environment.signInPolicy}/oauth2/v2.0/logout?client_id=${environment.clientID}&response_type=token&redirect_uri=${environment.redirectUrl}&scope=openid%20offline_access%20https://XXXX.onmicrosoft.com/api/demo.read;
// Import
import { OAuth2Client } from '@byteowls/capacitor-oauth2';
import { Plugins, registerWebPlugin, Capacitor } from '@capacitor/core';
const { Browser } = Plugins;
// In case WEB/Local
if (Capacitor.platform === 'web') {
await Browser.open({ url: urlLogout }).finally(() => setTimeout(() => Browser.close(), 1000));
this.onLogoutClick();
return;
}
// Workaround to get IOS logout
if(Capacitor.platform === 'ios'){
await Browser.open({ url: urlLogout }).finally(() => setTimeout(() => Browser.close(), 4000));
this.onLogoutClick();
return;
}
// In case IOS/Android
const browser = await Browser.open({ url: urlLogout });
Browser.close();
this.onLogoutClick();
}
Let me know if that works
Hi i am not using b2c , i'm using auth2option , i.e. **oauth2Options = { appId: 'XXXXXXXXXXXXXXXXXXXXXXXX', authorizationBaseUrl: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize', accessTokenEndpoint: 'https://login.microsoftonline.com/common/oauth2/v2.0/token', scope: 'https://graph.microsoft.com/User.Read', resourceUrl: "https://graph.microsoft.com/v1.0/me/", pkceEnabled: true, logsEnabled: true, responseType: 'code', web: {
redirectUrl: 'http://localhost:8100/login',
windowOptions: "height=600,left=0,top=0",
},
android: {
redirectUrl: 'msauth://.{package-name}/XXXXXXXXXXXXXXXXXX',
handleResultOnNewIntent: true,
handleResultOnActivityResult: true
},
ios: {
pkceEnabled: true, // workaround for bug #111
redirectUrl: "msauth.{package-name}://auth"
}
};** Kindly assist me on this.
Hello,
I was wondering how did you implement the logout on android, i'm using the below code but its not working. The browser is not being closed
Plugins.Browser.open({ url: environment.logoutURL }).finally(() => { setTimeout(() => Plugins.Browser.close(), 500); this.clearUser(); });
thanks for the help