FormidableLabs / react-native-app-auth

React native bridge for AppAuth - an SDK for communicating with OAuth2 providers

Home Page:https://commerce.nearform.com/open-source/react-native-app-auth

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding redirect uri to AndroidManifest throws error about requiring android:exported

errodevs-ford opened this issue · comments

Issue

I need to add multiple redirect uris to my application, so I needed to move it from the build.gradle to the android manifest. I followed the documentation and added:

<activity
        android:name="net.openid.appauth.RedirectUriReceiverActivity"
        tools:node="replace">
    <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="com.example.app"/>
    </intent-filter>
</activity>

But this throws the following error:

android:exported needs to be explicitly specified for element <activity#net.openid.appauth.RedirectUriReceiverActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

I was able to fix it by simply adding android:export to that activity. The documentation should be updated.

    <activity android:name="net.openid.appauth.RedirectUriReceiverActivity" android:exported="true" tools:node="replace">
      <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="com.example.app"/>
        <data android:scheme="com.example.app2"/>
      </intent-filter>
    </activity

Environment

  • Your Identity Provider: Google / Active Directory
  • Platform that you're experiencing the issue on: Android
  • Are you using Expo? No

Hi @errodevs-ford, can you please point me to the documentation from where you got this information?

@errodevs-ford you can refer to this link #611 (comment). it solved the issue.