adopted-ember-addons / ember-cognito

AWS Amplify/Cognito and ember-simple-auth integration
MIT License
32 stars 25 forks source link

Using latest amazon-congito-indentity-js with IE11 and a Fetch Polyfill? #119

Closed elgordino closed 5 years ago

elgordino commented 5 years ago

Using ember-cognito with version 1.31.0 of amazon-cognito-identity-js works fine in IE11. I would like to use it with the latest 3.0.9 because the package is much smaller, but that build relies on fetch which does not exist in IE11.

I tried adding ember-fetch but I guess this only applies to the ember environment and the amazon-cognito stuff exists outside that. Is there a recommended way to add a fetch polyfill that will work with amazon-cognit-identity-js.

paulcwatts commented 5 years ago

Hi @elgordino ,

I don't know if I have a "recommended" way, but I solve it just by assigning the ember-fetch polyfill to the global fetch. So I have this in my app.js:

import fetch from "fetch";

if (typeof FastBoot === "undefined") {
  if (window.fetch === undefined) {
    window.fetch = fetch;
  }
}

(If you don't use FastBoot, you can remove that check.)

I hope this helps!

elgordino commented 5 years ago

Thanks that helps a bunch, I'll do that. Cheers!