Skip to content

authorize() returns error 'Data intent is null' on Android #494

Closed
@KristineTrona

Description

@KristineTrona

Issue

Every time I call authorize() method I get Error: Data intent is null, whenever running on an Android emulator with 'R' operating system. Any idea what could be causing this error and how to fix it?

const config = {
  warmAndPrefetchChrome: Platform.OS === 'android',
  issuer,
  clientId,
  redirectUrl: 'testSchema://oauth/redirect',
  scopes: ['openid', 'profile', 'api', 'offline_access'],
  usePKCE: true,
};

export const authenticate = async () => {
  try {
    const result = await authorize(config);
    console.log('authorized')  // Execution never makes it to this line
    return result
  } catch (e) {
    throw new Error(e);
  }
};

In android/app/builde.gradle


    defaultConfig {
        applicationId "com.testApp"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0.0"
        resValue "string", "build_config_package", "com.testApp"
        manifestPlaceholders = [
            appAuthRedirectScheme: 'testSchema'
        ]

    }

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.testApp">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".SplashActivity"
        android:theme="@style/SplashTheme"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
        </intent-filter>
      </activity>
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize"
        android:exported="true">
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
      <provider
		    android:name="com.vinzscam.reactnativefileviewer.FileProvider"
		    android:authorities="${applicationId}.provider"
		    android:exported="false"
		    android:grantUriPermissions="true">
		    <meta-data
		    	android:name="android.support.FILE_PROVIDER_PATHS"
		    	android:resource="@xml/file_viewer_provider_paths"
		    />
	    </provider>
    </application>

</manifest>

Fails on all 3 of these, but works fine on 'Q' or 'Pie' operating systems:
Screenshot 2020-04-02 at 15 23 22

Environment

  • Your Identity Provider: IdentityServer 4
  • Platform that you're experiencing the issue on: Android (specific to version 'R')
  • Are you using Expo? No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions