1

I am using the ArcGIS Javascript API to connect to the arcgis.com portal. To do so I am calling portal.signIn(). The issue is that I don't want the user to be responsible for performing the login, bo I want to generate the REST API token on my server and then use that token from the Javascript API.

Mock code

portal = new esri.arcgis.Portal('http://www.arcgis.com');
dojo.connect(portal, 'onLoad', function() {
    portal.id.token="<server-side writes token here>";
    portal.signIn().then(function(loggedInUser){
        console.log(loggedInUser);
    });
});

EDIT:

From what I can tell in this sample http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/widget_identitymanager_client_side.html

I might be able to build my own credentials object to run esri.id.initialize() (which from what I understand is an implementation of esri.IdentityManager). I will try this and report back if it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.