When I set the portal, the layer is private in ArcGIS Enterprise, the login screen appears, how to log in it in the application?
require([
"esri/config"
], function (
esriConfig
) {
esriConfig.portalUrl = "https://MyApp/portal/";
});
Hi Wade, this link may help with what you are trying to do: https://developers.arcgis.com/javascript/latest/arcgis-organization-portals/
Hi GaryB
The document describes the ArcGIS Enterprise part, not very clear, is there a practical example?
yes, I recall struggling with this a bit, try this:
let info = new OAuthInfo({appId: 'xxxxxxxxxxxxxxxx', portalUrl: 'https://my.portal.url/portal', popup: false})
esriId.registerOAuthInfos([info])
esriId.checkSignInStatus(info.portalUrl + '/sharing').then(function () {
let portal = new Portal({url: 'https://my.portal.url/portal'})
portal.authMode = 'immediate'
portal.load().then(
function () {
console.log(portal.user.username + ' is now connected to the portal')
// call my afterSuccessfulLogin function
},
function (error) {
console.log("couldn't successfully load the portal")
}
)
})
ArcGIS Enterprise can also create appId?
The current way is to use ArcGIS Server generate token for verification.
Hello GaryB, I tested this method, but the user still needs to log in once. Is there a solution to build the identity information into the program without requiring the user to log in again? Thank you so much!
Hi @GaryB, I tested this method, but the user still needs to log in once. Is there any example, using the token method, the user does not need to log in once ?