ArcGIS JS 4 SAML auth

311
2
Jump to solution
04-24-2020 01:46 AM
VictorTey
Esri Contributor

Hi, I have been following the sample

Access ArcGIS Online items using OAuthentication - 4.15 

and i kept getting a invalid redirect_uri.

I have done the following

  • Add item -> application -> application 
  • Register info
  • Add my machine uri to the redirect_uri under registered info 
  • I have share this app to my organisation

my code

can someone please advise what have i done wrong?

var info = new OAuthInfo({
// Swap this ID out with registered application ID
appId: "c13v2Nuys97mUArm",
// Uncomment the next line and update if using your own portal
//portalUrl: "",
// Uncomment the next line to prevent the user's signed in state from being shared with other apps on the same domain with the same authNamespace value.
authNamespace: "portal_oauth_inline",
popup: true
});



IdentityManager.registerOAuthInfos([info]);


IdentityManager.getCredential(info.portalUrl + "/sharing")
.then(function(){
const map = new Map({
basemap: "hybrid",
layers: [layers]
});
const view = new MapView({
container: "viewDiv",
map: map,
center: [116, -32],
zoom: 10,
popup: {
autoOpenEnabled: true
}
});
//do whatever else


Tags (3)
0 Kudos
1 Solution

Accepted Solutions
DerrickWong
Esri Contributor

Hi Victor Tey

When you add  your machine uri to the redirect_uri under registered info for the application, did you include the full path?
 
e.g https://domain.com/xxx/xxx/xxx.html instead of just https:domain.com
 
 
Regards,
Derrick

View solution in original post

2 Replies
DerrickWong
Esri Contributor

Hi Victor Tey

When you add  your machine uri to the redirect_uri under registered info for the application, did you include the full path?
 
e.g https://domain.com/xxx/xxx/xxx.html instead of just https:domain.com
 
 
Regards,
Derrick

View solution in original post

VictorTey
Esri Contributor

Spot on. Thank you Derrick Wong

0 Kudos