Arcgis for JS 3.21, Android, Phonegap and OAuth2

672
2
08-02-2017 07:31 PM
JasonAllen1
New Contributor

I have created a hybrid app utilising ArcGIS for JS 3.21 and Phonegap. I am using the OAuth Basic example (OAuth Basic | ArcGIS API for JavaScript 3.21). I have updated the appId and the portalURL to suit however the redirect_uri created by "new OAuthInfo({...})" is pointing to the Android asset (redirect_uri=file%3A%2F%2F%2Fandroid_asset%2Fwww%2Fportal_items.html). I have found that I need to replace this with a known URI such as "urn:ietf:wg:oauth:2.0:oob" but there is no way (that I can find) to modify the redirect_uri in the OAuthInfo method.

I am attempting to port an ArcGIS for Android native app (complete offline mobile GIS app) I have built to include online functionality but am stuck at the first hurdle of being able to log into an organizational portal...

0 Kudos
2 Replies
ThomasSolow
Occasional Contributor III

I haven't managed identity in 3.XX but I would think you could pass in "popupCallbackUrl" to the OAuthInfo constructor, ie:

var info = new OAuthInfo({
  appId: "<pass in your application id here>",
  popup: true,
  popupCallbackUrl: "<url to redirect to>"
});

esriId.registerOAuthInfos([info]);
JasonAllen1
New Contributor

Thanks Thomas but I was trying to use the inline method without the popup as some users will have popups disabled. Portal seems to be a LOT of issues...

0 Kudos