0

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?

test.js

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

$.ajax({
    url: "/helloworld/index/display",
    type: "GET",
    complete: function (response) {
        access_token = response.responseText;
    }
});
3
  • you can use localstorage for that. Commented 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
    Commented May 8, 2020 at 4:36
  • you want to use only 1 access token for all customer? Commented May 9, 2020 at 6:33

0

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.