Select to view content in your preferred language

How to register a token for a web map and its layers?

119
1
Jump to solution
2 weeks ago
AlexDang
New Contributor

Hi all,

I have a connector that displays a web map in a dashboard based on a selection. When the dashboard is opened, I am generating a token via backend and passing it to the front end to call IdentityManager.registerToken(), and then initializing the web map.

I am registering a token for both the web map endpoint and the layer endpoint:

    IdentityManager.registerToken({
      server: "https://{portalUrl}/portal/sharing/rest",
      token: ArcGISToken.Token,
      // userId: "admin_user", // optional but useful
      expires: ArcGISToken.Expires
    });

    IdentityManager.registerToken({
      server: "https://{portalUrl}/mapping/rest/services",
      token: ArcGISToken.Token,
      expires: ArcGISToken.Expires
    });

 However, it still prompts a login on my dashboard that says "Please sign in to access the item on ...". Am I missing something here? I want to be able to silently authenticate and bypass the login as I've already used the username and password stored in the configuration to retrieve the token.

 

 

0 Kudos
1 Solution

Accepted Solutions
AlexDang
New Contributor

The issue was completely unrelated to how I've set up registerToken. When generating the token, I had to set client to requestip., and only the first registerToken was necessary.

View solution in original post

1 Reply
AlexDang
New Contributor

The issue was completely unrelated to how I've set up registerToken. When generating the token, I had to set client to requestip., and only the first registerToken was necessary.