oauth2 problems - redirect uri issue

6464
2
Jump to solution
09-19-2014 10:00 AM
by Anonymous User
Not applicable

OK I am following the oauth2sample example for Android. 

I have setup the app and it has a Client ID.  I also setup the app with the Redirect URI for which I put in "oauthdemo://auth". In Strings.xml I have the following....

<string name="portal_url">https://www.arcgis.com/</string>

  <string name="client_id">RtVrbexXFDewENQo</string>

    <string name="app_name">OAuth2Sample</string>

    <string name="login_type_dlg_message">Log in with saved credentials?</string>

    <string name="yes">Yes</string>

    <string name="no">No</string>

    <string name="enter_portal_url">Enter Portal URL</string>

    <string name="OAuth2_Sample">OAuth2 Sample</string>

  <string name="continue_with_saved_credentials">Continue with saved Credentials?</string>

  <string name="quit_app">Quit App?</string>

In the OAuth2 java class

OAuthView oAuthView = new OAuthView(context, getResources().getString(R.string.portal_url), getResources()

        .getString(R.string.client_id), new CallbackListener<UserCredentials>() {

When I run the sample I always get Error Invalid redirect_uri Error 400.  Where in the oAuthView example am I supposed to input the redirect uri?  I see no place for it in the code???? When I go into a web browser on the device it does take me to the correct location when I input the redirect uri and client id as follows...

https://www.arcgis.com/sharing/oauth2/authorize?response_type=code&client_id=RtVrbexXFDewENQo&redirect_uri=oauthdemo://a…

What gives??  How do I input the redirect uri into the code above to make it work?

1 Solution

Accepted Solutions
by Anonymous User
Not applicable

OK should have read the instructions more closely.  Boiled down to needing to get the redirect uri in as urn:ietf:wg:oauth:2.0:oob in the app itself.  Tried this the other day and it did not work, but it does now.

View solution in original post

0 Kudos
2 Replies
by Anonymous User
Not applicable

Just a quick followup.  I can get the code to take me to the login redirect by putting in the entire path via the app.  However it always fails to login either via the sample app or web browser.

https://www.arcgis.com/sharing/oauth2/authorize?response_type=code&client_id=RtVrbexXFDewENQo&redire...

0 Kudos
by Anonymous User
Not applicable

OK should have read the instructions more closely.  Boiled down to needing to get the redirect uri in as urn:ietf:wg:oauth:2.0:oob in the app itself.  Tried this the other day and it did not work, but it does now.

0 Kudos