Oauth2.0 token append issue

277
0
12-03-2018 02:26 AM
vikashkumar1
New Contributor

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.

0 Kudos
0 Replies