Select to view content in your preferred language

DefaultOAuthIntentReceiver OAuth Redirect URI

564
6
01-26-2024 05:53 AM
NathanMeade
New Contributor II

From the sample code, the redirect URI is as follows:

"authenticate-with-oauth"
 
Example:
<activity
android:name="com.esri.arcgisruntime.security.DefaultOAuthIntentReceiver"
android:exported="true"
android:launchMode="singleTask">
<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:host="@string/oauth_redirect_host"
android:scheme="@string/oauth_redirect_uri" />
</intent-filter>
</activity>
 
Where "oauth_redirect_host is "auth" and "oauth_redirect_uri" is "authenticate-with-oauth". When used properly in the sample code as shown in: https://developers.arcgis.com/android/java/sample-code/authenticate-with-oauth/
 
This works as expected. Here's my question though, why does any other redirect URI not navigate back to the Android app? When I use a different redirect URI I either see an error displayed before I can even log in or I just continuously see the login prompt after logging in. I've tried multiple different configurations without success. I thought this post would help but I still observe the same issue: https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/android-oauth-what-should-i-u...
0 Kudos
6 Replies
RamaChintapalli
Esri Contributor

Hi,
When we register your app for OAuth, we have to specify the re-directURI. For a given ClientID, only the registered re-directURIs are allowed. For the sample, the redirectURI allowed is `authenticate-with-oauth://auth`. You need to register your own app.

Thanks
Rama

0 Kudos
NathanMeade
New Contributor II

Yes, I am already doing this. I am registering different redirect URIs to my ESRI Application for the given client id. When I reference any redirect URI I already have set that isn't  `authenticate-with-oauth://auth` then I just get the infinite loop of being prompted to login. Why is this the only redirect URI that actually navigates back to the app?

0 Kudos
RamaChintapalli
Esri Contributor

Can you share the other re-directURIs format that you specified at the time of registering the app? The browsers expect it to be <my-custom-app-scheme>://<my-custom-app-host>. The semi-colon with two forward slashes is required

Thanks
Rama

0 Kudos
NathanMeade
New Contributor II

The main one that I was using was "MobileMap://auth". I had this set as a redirect URI for my ESRI application and also was in the Android code as well (DefaultOAuthIntentReceiver in AndroidManifest.xml and OAuthConfiguration in MainActivity).

0 Kudos
RamaChintapalli
Esri Contributor

The re-direct URI seems fine. Would it be possible to share your repro code (using a temporary account)  via a direct message  or provide network logs via direct message or debug your app through our support?

0 Kudos
NathanMeade
New Contributor II

Hey Rama, I appreciate your help on this. I believe that I do actually have it working now. I'm not allowed to share the source code but in case I end up having issues again with this I could pursue one of those other two options.

0 Kudos