I'm working on an ESRI JavaScript App. My app needs to support OAuth2 authentication.

The code below shows how the client logs in and how I get the client's credentials. What I need is the token variable from the client credentials.

The code below works when the user isn't logged in. The credentials array comes back as empty when the client is logged into the ArcGIS Server endpoint. What's really strange is that the code works when the client is logged into our Portal. It just fails when the client has logged into our ArcGIS Server Directory. The reason I need the token is that I'm sending GET requests as queries to certain feature layers. The get requests have to have a token themselves since the services are secured.
How can I get the client credentials when the client is already logged into ArcGIS Server?

    //create the OAuth2 handle for logins
    var info = new OAuthInfo({
        appId: "appID",
        portalUrl: "portalURL",
        popup: false

    //get token for signed in user

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.