Select to view content in your preferred language

changing token duration

414
1
09-03-2022 04:18 AM
Mannus_Etten
New Contributor III

i set those properties in my oauthinfo-object:

    expiration: 200,
    minTimeUntilExpiration: 180,
 
i can see in the console log that those settings are set but when i obtain an token and check
credential.expires the timestamp is still only 30 minutes valid.
 
I would like to make this period longer or it would be nice if i can obtain the refreshtoken
from the oauthinfo-object.
In that case my backend can renew the access token.
CEO the Right Direction BV/Portal Genius
0 Kudos
1 Reply
JeffreyWilkerson
Occasional Contributor III

Here's a call using jQuery with an object that has the expiration set to 200, and the resulting token says that it's valid for '12000':

var form = new FormData();
var settings = {
  "url": "https://www.arcgis.com/sharing/rest/oauth2/token?client_id=xxx&client_secret=xxx&grant_type=client_credentials&expiration=200",
  "method": "POST",
  "timeout": 0,
  "processData": false,
  "mimeType": "multipart/form-data",
  "contentType": false,
  "data": form
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

 

Resulting token:

{
    "access_token": "xxx..",
    "expires_in": 12000
}

 

Client, client secret, and resulting tokens were obfuscated to protect the innocent...

0 Kudos