IdentityManager in 4.6 is broken?

1830
8
Jump to solution
02-15-2018 08:25 AM
BrianJohnston4
New Contributor III

I grabbed the basic oath sample for the 3.23 API from here: https://developers.arcgis.com/javascript/3/jssamples/portal_oauth_inline.html

set the portal url to our internal Portal for ArcGIS and it worked.   Next, I upgraded it to the 4.6 API and now it no longer works.  I get no errors in the console, it does redirect to the oath page and allow me to login, but it just does not reload the page afterwards.  I tried both inline and popup, same result. 

0 Kudos
1 Solution

Accepted Solutions
MunachisoOgbuchiekwe
New Contributor III

Seems like this sample still points to Arcgis Online even when you set the portalUrl. To fix this I set the esriConfig.portalUrl = info.portalUrl after including the esri/config module. This should make the sample point to your portal and allow you to view the items.

View solution in original post

8 Replies
RobertScheitlin__GISP
MVP Emeritus

Brain,

  Have you looked at the 4.x docs for the IdentityManager class?

IdentityManager | API Reference | ArcGIS API for JavaScript 4.6 

Most code/sample do not work by just changing the api version (a lot has changed between the two).

0 Kudos
BrianJohnston4
New Contributor III

Yes I scanned the docs, looked for new sample code, etc. I didn’t find an equivalent sample for the 4.6 API so that’s when I opted to port the old sample over. First, I compared the classes and methods and determined they have not changed as far as I can tell.

0 Kudos
ReneRubalcava
Frequent Contributor

Here's the 4.6 OAuth Sample

Can you try that sample and see if your problem persists?

Thanks!

KenBuja
MVP Esteemed Contributor

It would be pretty helpful to put a link to this sample in the IdentifyManager and OAuthInfo classes.

0 Kudos
BrianJohnston4
New Contributor III

Rene,

Thank you for finding the sample for 4.6. I downloaded it, pointed it to my Portal and did get a slightly different outcome. It does let me login to the oath page, but then the page background turns grey and small dialog box prompt me to login again. The identity manager never redirects back to the web page like it should. Another clue is I can see the get request from the IdentityManager going to the server and it looks like this:

https://[ourportal]/arcgis/sharing/rest?f=json&token=[long token string]

The response to the request is http 200 with this in the body:

{"currentVersion":"5.1"}

0 Kudos
KenBuja
MVP Esteemed Contributor

Did you change the appId value? You'll have to set one up for your application. Implementing App Login | ArcGIS for Developers 

0 Kudos
BrianJohnston4
New Contributor III

Ken,

Yes I did. The appID and portal url work fine with the 3.23 sample.

0 Kudos
MunachisoOgbuchiekwe
New Contributor III

Seems like this sample still points to Arcgis Online even when you set the portalUrl. To fix this I set the esriConfig.portalUrl = info.portalUrl after including the esri/config module. This should make the sample point to your portal and allow you to view the items.