Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure SSO; Response comes from azure, but does not come to authenticate #249

Open
joelutting opened this issue Feb 15, 2024 · 0 comments
Open

Comments

@joelutting
Copy link

Description

I call OAuth2Client.authenticate on android; the MS auth page opens and I click 'continue' to login with my MS account.

Then the logs show a returned object with the code in it.

The data is not returned to the promise though, with the promise response being undefined. (logs shown below)

Also I need token but when I change from code to token the whole thing fails.

2024-02-15 11:55:52.167 19164-19164 Capacitor io.ionic.i4m.omniascout D Unable to find a Capacitor plugin to handle requestCode, trying Cordova plugins 1389386085
2024-02-15 11:55:52.169 19164-19164 Capacitor/...ientPlugin io.ionic.i4m.omniascout I Authorization response:
{"request":{"configuration":{"authorizationEndpoint":"https://login.microsoftonline.com/42c16220-86f6-46a1-9020-5c53af214eea/oauth2/v2.0/authorize","tokenEndpoint":"https://login.microsoftonline.com/42c16220-86f6-46a1-9020-5c53af214eea/oauth2/v2.0/authorize"},"clientId":"a18ca770-a6a0-4fbe-973b-8f4a8dc48ed0","responseType":"code","redirectUri":"msauth://io.ionic.i4m.omniascout/"scope":"https://graph.microsoft.com/User.Read","state":"bjvvZvyicw33BYebmAMk","nonce":"zFJymOh5rG0RbIaUQ0xxEg","codeVerifier":"szk5g6P9ZrDiUimiZDbVSBJ9T4OGRZUPuSnBoM2jIXdvqWoIcYuQplfC9gDFQH5E","codeVerifierChallenge":"5NSX9DK54wZP1DOoyyUZiwfD_t1v8a3cDdhtAs7qCZA","codeVerifierChallengeMethod":"S256","responseMode":"query","additionalParameters":{}},"state":"bjvvZvyicw33BYebmAMk","code":"0.AREAIGLBQvaGoUaQIFxTryFO6nCnjKGgpr5PlzuPSo3EjtAXAa8.AgABAAIAAAAmoFfGtYxvRrNriQdPKIZ-AgDs_wUA9P-QUDgR5NHn5JhZqraxDpBtN3zmYa1fdMbdySJ8i8lWGCelaaDU4E-4LVXd5c1SmVxaFzAAgJduSswUkmiSznulv-uAwsYB_Mi_OKws3lr0pifogJNMEkBrGk2P0lmACV5_ZD01mwHcd8211Em53BPPeDfUUyfJQORPlz-_KhzZ0geAu4q1CZoQu7DAd2g0mZ0ePHtFuVZ1BpoIXANROn0zTDbsINMjxmO1O4gelHo4LzeUgoVIN6e8oJnzNyGd1W2qSGY37vZGGXShedI0WaNqoTEDb8YirJk_SOdAnw3-SPsPmUH5VGeJuDl4wkmfQWMvocLr2BkfDJ9-1zmAdXcwAx1QBwviFcWqZMbUHCe2IiUKZDDiAENHmjk_9y_0HLhz_hYaWqHKQ2zDPAh31zy1KZjrjcoNn4BuLE-MG0fQSXXFytGRbdAiO0lDWGEiB5-Oz6Ae6gtABUwXcLn5uuz0plKjo77K7STttJHQKkDsSUjzClb3JJUHpPE5K7RMi63XaB-sFyBMW7UoN1IdPZrgg4gHVG9vkwrq1kXMcd3pz-iahAFVN_oKDQsPBsUk6TU_LShrW4e_NaJiJSH-EwCo3R11GOcRCxuKaF1HKshpxbzB6sSAbDc05WLuhowfSCT2eSmMZXi5UhlJxKBqKwXh5oW2Cs5uAz0q7pZWc4CJ8h7TMtbM5ftER_FKlE9KbSqytPzlUQICaPU5rvxxoQE0ePBHxsaoztWfnn4qZQcbwlR1QUkRcJgXBpyGr60kOC6zLBIkIzXP0scfWiZub8QuTprlRqtbUBltAxVGi_s0hDrJQ9w1YYk9mgp2JGlFlqQzrnZW4-uBOQehqZMAmcK8dHc9n1E","additional_parameters":{"session_state":"aa41ca8d-fee5-4794-a2c3-f41907b14383"}}
2024-02-15 11:55:52.170 19164-19164 ViewRootIm...nActivity] io.ionic.i4m.omniascout I stopped(false) old = false
2024-02-15 11:55:52.171 19164-19164 Capacitor/AppPlugin io.ionic.i4m.omniascout D Firing change: true
2024-02-15 11:55:52.171 19164-19164 Capacitor/AppPlugin io.ionic.i4m.omniascout V Notifying listeners for event appStateChange
2024-02-15 11:55:52.171 19164-19164 Capacitor/AppPlugin io.ionic.i4m.omniascout V Notifying listeners for event resume
2024-02-15 11:55:52.172 19164-19164 ConnectivityManager io.ionic.i4m.omniascout D StackLog: [android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:4300)] [android.net.ConnectivityManager.registerDefaultNetworkCallbackForUid(ConnectivityManager.java:4864)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4831)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4805)] [com.capacitorjs.plugins.network.Network.startMonitoring(Network.java:138)] [com.capacitorjs.plugins.network.NetworkPlugin.handleOnResume(NetworkPlugin.java:60)] [com.getcapacitor.Bridge.onResume(Bridge.java:1284)] [com.getcapacitor.BridgeActivity.onResume(BridgeActivity.java:85)] [android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1531)] [android.app.Activity.performResume(Activity.java:8734)] [android.app.ActivityThread.performResumeActivity(ActivityThread.java:5351)] [android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5444)] [android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54)] [android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)] [android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)] [android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)] [android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)]
2024-02-15 11:55:52.176 19164-19164 Capacitor io.ionic.i4m.omniascout D App resumed
2024-02-15 11:55:52.177 19164-19164 DecorView io.ionic.i4m.omniascout I notifyKeepScreenOnChanged: keepScreenOn=false
2024-02-15 11:55:52.182 19164-19291 Capacitor/NetworkPlugin io.ionic.i4m.omniascout V Notifying listeners for event networkStatusChange
2024-02-15 11:55:52.190 19164-19164 MSHandlerLifeCycle io.ionic.i4m.omniascout I removeMultiSplitHandler: no exist. decor=DecorView@a97b481[MainActivity]
2024-02-15 11:55:52.191 19164-19164 Capacitor/Console io.ionic.i4m.omniascout I File: http://localhost/src_app_map_map_module_ts.js - Line 10826 - Msg: =================================================
2024-02-15 11:55:52.191 19164-19164 Capacitor/Console io.ionic.i4m.omniascout I File: http://localhost/src_app_map_map_module_ts.js - Line 10827 - Msg: =================================================
2024-02-15 11:55:52.191 19164-19164 Capacitor/Console io.ionic.i4m.omniascout I File: http://localhost/src_app_map_map_module_ts.js - Line 10828 - Msg: MS SSO LOGIN RETURNED
2024-02-15 11:55:52.192 19164-19164 Capacitor/Console io.ionic.i4m.omniascout I File: http://localhost/src_app_map_map_module_ts.js - Line 10829 - Msg: =================================================
2024-02-15 11:55:52.192 19164-19164 Capacitor/Console io.ionic.i4m.omniascout I File: http://localhost/src_app_map_map_module_ts.js - Line 10830 - Msg: =================================================
2024-02-15 11:55:52.192 19164-19164 Capacitor/Console io.ionic.i4m.omniascout I File: http://localhost/src_app_map_map_module_ts.js - Line 10831 - Msg: MS SSO returned
2024-02-15 11:55:52.193 19164-19164 Capacitor/Console io.ionic.i4m.omniascout I File: http://localhost/src_app_map_map_module_ts.js - Line 10833 - Msg: undefined
2024-02-15 11:55:52.193 19164-19164 Capacitor/Console io.ionic.i4m.omniascout I File: http://localhost/src_app_map_map_module_ts.js - Line 10834 - Msg: undefined
2024-02-15 11:55:52.193 19164-19164 Capacitor/Console io.ionic.i4m.omniascout I File: http://localhost/src_app_map_map_module_ts.js - Line 10835 - Msg: undefined
2024-02-15 11:55:52.194 19164-19164 Capacitor/Console io.ionic.i4m.omniascout I File: http://localhost/ - Line 328 - Msg: undefined

Capacitor version: 5

Replace this with the commands output

Library version:

  • 5.0.0

OAuth Provider:

  • Azure AD (B2C)

Your Plugin Configuration

{
        appId: environment.oauthAppId.azureBc2.appId,
        authorizationBaseUrl: 'https://login.microsoftonline.com/{... my stuff}/oauth2/v2.0/authorize',         
        scope: "https://graph.microsoft.com/User.Read", // See Azure Portal -> API permission
        accessTokenEndpoint: 'https://login.microsoftonline.com/{...}/oauth2/v2.0/token',
        responseType: "token",
        pkceEnabled: true,
        logsEnabled: true,
        web: {
          responseType: "token",
          accessTokenEndpoint: "",
          redirectUrl: 'http://localhost:8100/', //environment.redirectUrl,
        },
        android: {
          accessTokenEndpoint: '',
          responseType: "code",
          redirectUrl: "msauth://io.ionic.i4m.omniascout/{...sig hash}" 
            
        },
        ios: {
            pkceEnabled: true, // workaround for bug #111
            redirectUrl: "msauth.io.ionic.i4m.omniascout://auth"
        },
        additionalParameters: {
          response_mode: "query"
        }        
}

Affected Platform(s):

  • Android
    • Version/API Level: 33
    • Device Model: Galaxy S4
    • Content of your AndroidManifest.xml
    <!-- 
      <queries>
          <intent>
                  <action android:name="android.intent.action.SENDTO" />
                  <data android:scheme="mainto" />
          </intent>
      </queries>
    
    
      <application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:largeHeap="true"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:supportsRtl="true"
          android:theme="@style/AppTheme">
          <activity
              android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
              android:name="io.ionic.starter.MainActivity"
              android:label="@string/title_activity_main"
              android:theme="@style/AppTheme.NoActionBarLaunch"
              android:launchMode="singleTask"
              android:exported="true">
              <intent-filter>
                  <action android:name="android.intent.action.MAIN" />
                  <category android:name="android.intent.category.LAUNCHER" />
              </intent-filter>
    
            <!-- azure ad b2c -->
            <intent-filter>
              <action android:name="android.intent.action.VIEW" />
              <category android:name="android.intent.category.DEFAULT" />
              <category android:name="android.intent.category.BROWSABLE" />
              <data android:scheme="@string/custom_url_scheme" android:host="oauth" />
            </intent-filter>
    
          </activity>
    
    
        <activity android:name="net.openid.appauth.RedirectUriReceiverActivity" android:exported="true">
          <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="@string/custom_url_scheme" android:host="@string/custom_host" />
          </intent-filter>
    
          <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="@string/azure_b2c_scheme" android:host="@string/package_name" android:path="@string/azure_b2c_signature_hash" />
          </intent-filter>
        </activity>
    
          <provider
              android:name="androidx.core.content.FileProvider"
              android:authorities="${applicationId}.fileprovider"
              android:exported="false"
              android:grantUriPermissions="true">
              <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
          </provider>
      </application>
    
      <!-- Permissions -->
    
      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
      <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
      <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
      <uses-feature android:name="android.hardware.location.gps" />
    

-->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant