AnsweredAssumed Answered

Oauth2.0 token append issue

Question asked by vikakuma on Dec 3, 2018

HI,

 

I am trying to use Oauth protocol for accessing secure map services.

I am able to get the token but somehow the token is not getting appended automatically in respective service call.

Below is my code:

 

const request = EsriRequest({
url: '<path>/sharing/rest/oauth2/token',
callbackParamName: 'callback',
content: {
   client_id: '****',
   client_secret: '*****',
   grant_type: 'client_credentials'
   f: 'json'
},
});

// register oauthInfo with identity manager (esriId)
this.esriId.registerOAuthInfos([new OAuthInfo({
   appId: '*****',
   popup: false,
   portalUrl: '<path>/arcportal'
})]);

// register token with identity manager
this.esriId.registerToken({
   expires: this.token.expires_in,
   server: '<path>/arcportal',
   token: this.token.access_token,
   ssl: false,
   userId: '****'
});

 

Any help will be appreciated.

Outcomes