Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

230
Vistas
Unable to select different account while trying to login from mobile which is SSO enabled by @byteowls/capacitor-oauth2

I have a react web app which is being converted to mobile app by using capacitor js. Have used @byteowls/capacitor-oauth2 for the sso part. while using on the web, user is being prompted to select the microsoft account, but on mobile(android and ios), its asking for the confirmation of the previous login. I tried to use prompt=select_account in the config but the plugin doesnt support that. I was able to override the plugin code to add the prompt. still I dont get the prompt dialogue on. mobile.

Any help would be grateful. Apologies for bad english. Thanks in advance.

Below is the code.

const microsoftOAuthOptions = {
    appId: 'microsoftAppID',
    authorizationBaseUrl: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
    accessTokenEndpoint: '',
    scope: 'openid',
    responseType: 'token',
    logsEnabled: true,
    web: {
        redirectUrl: 'microsoftRedirectionUrl',
    },
    android: {
        pkceEnabled: true,
        responseType: 'code',
        redirectUrl: 'com.xxxx.app://oauth/auth',
        accessTokenEndpoint: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
    },
    ios: {
        pkceEnabled: true,
        responseType: 'code',
        redirectUrl: 'com.xxxxx.app://oauth/auth',
        accessTokenEndpoint: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
    },
};

const onOAuthBtnClick = async () => {
    OAuth2Client.authenticate(microsoftOAuthOptions).then((response) => {
        let accessToken =
            response.access_token ||
            response.authorization_response ||
            response.access_token_response;

        if (typeof accessToken === 'string') {
            localStorage.setItem('accessToken', accessToken);
        } else {
            localStorage.setItem(
                'accessToken',
                accessToken.access_token || accessToken['/access_token']
            );
        }
        dispatch && dispatch(loginActions.IsUserLoggedIn(true));
        dispatch && dispatch(loginActions.loginLoader());
    });
};

const onLogoutClick = () => {

    OAuth2Client.logout(microsoftOAuthOptions)
        .then(() => {
            localStorage.clear();
            dispatch && dispatch(loginActions.IsUserLoggedIn(false));
        })
        .catch((reason) => {
            console.error('OAuth logout failed', reason);
        });
};
about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda