I use ajax to get the access token from the external API. How can I store the expired time across the site and the ajax only call again when the session expired?


/helloworld/index/display is the controller that will get the input from Store -> Configuration and call the external API by using cURL

    url: "/helloworld/index/display",
    type: "GET",
    complete: function (response) {
        access_token = response.responseText;
  • you can use localstorage for that. May 7, 2020 at 5:52
  • @Hitesh Agrawal for localstorage, each customer will have a different access token. However, I would like to use only 1 access token key across the site and it will reset when the session expired
    – Tony Le
    May 8, 2020 at 4:36
  • you want to use only 1 access token for all customer? May 9, 2020 at 6:33


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.