AnsweredAssumed Answered

How to change the expiration time of the token generated in application developed using Web App Builder

Question asked by mayur.patel on Feb 5, 2018

Hi,
I have developed an app using Web App Builder developer Edition and I am trying to change the expiration time of the token in tokenUtils.js file as below 

         

 

 var oAuthInfo = esriNS.id.findOAuthInfo(portalUrl);

      if(!oAuthInfo){

        var oauthReturnUrl = window.location.protocol + "//" + window.location.host +

         require.toUrl("jimu") + "/oauth-callback.html";

        //OAuth will lose 'persist' query parameter if set expiration to two weeks exectly.

        oAuthInfo = new OAuthInfo({

          appId: appId,

          //expiration: 14 * 24 * 60 - 1,

          expiration: 2,

          portalUrl: portalUrl,

          authNamespace: '/',

          popup: true,

          popupCallbackUrl: oauthReturnUrl

        });

        esriNS.id.registerOAuthInfos([oAuthInfo]);

      }

 

 

 

 But while checking the response of generated token request in network tab, I am getting the token value and expiration time as below

 

{"token":"asdfghjk","expires":1518432766610,"ssl":false}

 Hence the token is not getting expired in 2 mins as desired.

Outcomes