Azure-Samples / ms-identity-javascript-v2

VanillaJS sample using MSAL.js v2.x and OAuth 2.0 Authorization Code Flow with PKCE on Microsoft identity platform
MIT License
105 stars 84 forks source link

IE11 ES6 Syntax Error for => #24

Closed godwin3737 closed 3 years ago

godwin3737 commented 3 years ago

Please follow the issue template below. Failure to do so will result in a delay in answering your question.

Library

Important: Please fill in your exact version number above, e.g. msal@2.1.3.

Framework

Description

The sample doesnt work on IE 11, throws syntax error on ES6 comptatiblity for =>

Error Message

Syntax error

Security

Regression

Version:

MSAL Configuration

// Provide configuration values here.
// For Azure B2C issues, please include your policies.

Reproduction steps

// Provide relevant code snippets here.
// For Azure B2C issues, please include your policies.

Expected behavior

Tried babel polyfill , but tht doesnt seem to fix the issue.

Browsers/Environment

error

derisen commented 3 years ago

Our samples use ES6 conventions, in particular promises, arrow functions and template literals. As such, they will not work on IE 11 out-of-the-box. For promises, you need to add a polyfill, e.g.:

<head>
   <!-- adding pollyfil for promises on IE11  -->
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/js-polyfills/0.1.42/polyfill.min.js"> 
   </script>
</head>

For arrow functions and template literals, you need to transpile them to older JavaScript. You can use this tool to help with the process.

godwin3737 commented 3 years ago

Should I create a PR with the changes to this sample ?

derisen commented 3 years ago

@godwin3737 we would rather keep this sample in ES6. For a sample compatible with IE11, please check out this.

godwin3737 commented 3 years ago

That works for me @derisen , Thanks!