capacitor-community / generic-oauth2

Generic Capacitor OAuth 2 client plugin. Stop the war in Ukraine!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The login is not redirecting to the iOS app

migue99angel opened this issue · comments

Description

We are trying to integrate the Google social login, we have tried the plugin in web and Android and it works fine. But we have a problem with the iOS app. The app uses the web configuration on iOS, this way the redirectUrl used is the same url used in web instead of the url we have defined in the iOS configuration (The app's bundle ID)

Capacitor version:

Run npx cap doctor:
💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 3.5.1
@capacitor/core: 3.5.1
@capacitor/android: 3.5.1
@capacitor/ios: 3.5.1

Installed Dependencies:

@capacitor/cli: 3.3.0
@capacitor/core: 3.3.0
@capacitor/android: 3.4.1
@capacitor/ios: 3.4.1

[success] Android looking great! 👌
[success] iOS looking great! 👌

Library version:

  • 3.0.1

OAuth Provider:

  • Google

Your Plugin Configuration

    OAuth2Client.authenticate({
      appId: '',
      scope: 'email profile',
      resourceUrl: 'https://www.googleapis.com/userinfo/v2/me',
      logsEnabled: true,
      authorizationBaseUrl: 'https://accounts.google.com/o/oauth2/auth',
      web: {
        appId: environment.oauthAppId.google.web,
        responseType: 'token', 
        accessTokenEndpoint: '', 
        redirectUrl: environment.oauthRedirectPath,
        windowReplace: false,
        windowOptions: 'width=500,height=600,left=0,top=0',
      },
      android: {
        appId: environment.oauthAppId.google.android,
        responseType: 'code', // if you configured a android app in google dev console the value must be "code"
        redirectUrl: 'my.android.id:/', // package name from google dev console
      },
      ios: {
        appId: environment.oauthAppId.google.ios,
        responseType: 'code', // if you configured a ios app in google dev console the value must be "code"
        redirectUrl: 'my.apple.id:/', // Bundle ID from google dev console
      },
    }

Affected Platform(s):

  • iOS
    • Version/API Level:
    • Device Model: any device
    • Content of your Info.plist
<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLName</key>
            <string>my.apple.id</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>my.apple.id</string>
            </array>
        </dict>
        <dict/>
    </array>

Hi , did you find solution to this problem? I am using Azure AD b2c , login is working fine in web but redirection is not working on android. it always picks up localhost:8100, web configuration

Hi, I have the same problem on IOS, after successful login, I can detect the redirection URL in my capacitor-Ionic app, but the browser doesn't close...

Hi , did you find solution to this problem? I am using Azure AD b2c , login is working fine in web but redirection is not working on android. it always picks up localhost:8100, web configuration

do you have any update? I am facing same issue.