capacitor-community / generic-oauth2

Generic Capacitor OAuth 2 client plugin. Stop the war in Ukraine!
MIT License
232 stars 115 forks source link

Android Azure AD not redirecting to app #277

Closed mirkin-pixel closed 3 weeks ago

mirkin-pixel commented 4 weeks ago

Description

I read the full manual and followed the example for Azure: https://github.com/capacitor-community/generic-oauth2?tab=readme-ov-file#azure-active-directory--azure-ad-b2c. The app opens the Azure login pages but it does not seem to redirect to the app. It stays at the question: Are you trying to sign in to ? When I click continue it does not continue.

The chrome ispect gives the message that the url is not accessible: msauth://###/###?code=### (### has been replaced instead of the original values)

Capacitor version:

Run npx cap doctor:

6.1.2

OAuth Provider:

Your Plugin Configuration

{
        appId: '###',
        authorizationBaseUrl: `https://login.microsoftonline.com/###/oauth2/v2.0/authorize`,
        scope: 'https://graph.microsoft.com/User.Read',
        accessTokenEndpoint: `https://login.microsoftonline.com/###/oauth2/v2.0/token`,
        resourceUrl: 'https://graph.microsoft.com/v1.0/me/',
        responseType: 'code',
        pkceEnabled: true,
        logsEnabled: true,
        web: {
            redirectUrl: 'http://localhost:8100/',
            windowOptions: 'height=600,left=0,top=0',
        },
        android: {
            pkceEnabled: true,
            responseType: 'code',
            redirectUrl: 'msauth://###/###', // See Azure Portal -> Authentication -> Android Configuration "Redirect URI"
            accessTokenEndpoint: `https://login.microsoftonline.com/###/oauth2/v2.0/token`,
            handleResultOnNewIntent: true,
            handleResultOnActivityResult: true
        },
    }

Affected Platform(s):

reinaldoborin commented 4 weeks ago

I am having the same problem, 5 days trying to fix.

reinaldoborin commented 4 weeks ago

Looks like the deeplink is not working to back to app.

mirkin-pixel commented 3 weeks ago

Issue completely solved by following this part: https://github.com/capacitor-community/generic-oauth2#android-1