Auth0 Home Blog Docs

Example Script works everywhere EXCEPT in IE

I have been following this QuickStart: https://auth0.com/docs/quickstart/spa/vanillajs/02-user-profile

And after testing on my PC uploaded the project to my website, after:

  • changing the base tag to <base href="/testarea/auth0"> (in index.html)
  • adding my domain as an Origin (in Dashboard)
  • adding my domain (with path) as a Callback (also in Dashboard)

everything worked perfectly UNTIL I started testing in Internet Explorer.

Both Firefox and Chrome allowed me to sign-up and log-in, Internet Explorer just chokes. The error message from the console (F12 to get console) says:

SCRIPT1002: Syntax error
app.js (63,48)

Which corresponds to the start of the arrow function in this code :

  function renewTokens() {
   webAuth.checkSession({}, (err, authResult) => {
      if (authResult && authResult.accessToken && authResult.idToken) {
        localLogin(authResult);
      } else if (err) {
        alert(
            'Could not get a new token '  + err.error + ':' + err.error_description + '.'
        );
        logout();
      }
      displayButtons();
    });
  }

TIA, S

PS I wouldn’t be using IE if I had a choice :persevere:

PSS I assume it goes without saying that I’d appreciate help getting this modified for IE :wink:

Oh wow - IE does not support Arrow Functions :rofl:

Modified code works…

function renewTokens() {
  webAuth.checkSession({}, function (err, authResult) {
    if (authResult && authResult.accessToken && authResult.idToken) {
      localLogin(authResult);
    } else if (err) {
      alert('Could not get a new token ' + err.error + ':' + err.error_description + '.');
      logout();
    }
    displayButtons();
  });
}
1 Like

Glad you made it work and thanks for sharing with the rest of community!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.