Select to view content in your preferred language

https://www.arcgis.com/sharing/rest error 400

2189
1
05-18-2017 12:53 PM
LenHannam
New Contributor

I'm working on the tutorial "Author, edit, and save maps to your portal" at

https://developers.arcgis.com/net/latest/wpf/guide/author-edit-and-save-maps-to-your-portal.htm

I get to the point where I want to save my map in the instruction: "When you click Save Map to Portal, a dialog should appear prompting you to sign in to ArcGIS Online."

I get the following error:

Invalid redirect_uri


Error: 400

the statements in my C# code that throws this error are ( second line throws the error):

// Indicate the url (portal) to authenticate with (ArcGIS Online)

challengeRequest.ServiceUri = new Uri("https://www.arcgis.com/sharing/rest");

// Call GetCredentialAsync on the AuthenticationManager to invoke the challenge handler

await AuthenticationManager.Current.GetCredentialAsync(challengeRequest, false);

I have properly registered my app and am using my own client ID :

// Client ID for the app registered with the server (Portal Maps)

private const string AppClientId = "XXXXXXXXXXXXX";

Please help!

Thanks,

Len Hannam

0 Kudos
1 Reply
NagmaYasmin
Esri Contributor

Hi Len,

In the code, whatever url you are using for the constannt variable 

  private const string OAuthRedirectUrl = "http://myapps.portalmapapp";  //your ArcGIS online organization url

you need to add the same url in the Redirect Uri of the App's "Registered info". It work for me. Hope that helps.

Nagma