SpoonX / aurelia-authentication

Authentication plugin for aurelia.
http://aurelia-authentication.spoonx.org
MIT License
90 stars 60 forks source link

storageChangedReload triggers error #402

Closed VMBindraban closed 6 years ago

VMBindraban commented 6 years ago

When enabling storageChangedReload and logout in a other window/tab i am getting the following error:

aurelia-authentication.js?cca0:1087 Uncaught TypeError: _this8.authentication.updateAuthenticated is not a function
    at AuthService.storageEventHandler (aurelia-authentication.js?cca0:1087)

Which is:

if (_this8.config.autoUpdateToken && _this8.authentication.getAccessToken() && _this8.authentication.getRefreshToken()) {
  _this8.authentication.updateAuthenticated();

  return;
}

Using webpack.

It works fine for login.

doktordirk commented 6 years ago

i believe that might be fixed. can you update/ensure to 3.8.1

VMBindraban commented 6 years ago

I tried updating to 3.8.1 but i got errors.

aurelia-authentication.js?cca0:1729 Uncaught (in promise) TypeError: Cannot read property 'origin' of undefined
    at Object.configure (aurelia-authentication.js?cca0:1729)
    at eval (aurelia-framework.js?517a:186)
function configure(frameworkConfig, config) {
  if (!_aureliaPal.PLATFORM.location.origin) { // <=== here
    _aureliaPal.PLATFORM.location.origin = _aureliaPal.PLATFORM.location.protocol + '//' + _aureliaPal.PLATFORM.location.hostname + (_aureliaPal.PLATFORM.location.port ? ':' + _aureliaPal.PLATFORM.location.port : '');
  }

I also placed this on gitter yesterday.

RWOverdijk commented 6 years ago

Weird that location is undefined. Is this running headless by any chance?

VMBindraban commented 6 years ago

Latest version of chrome, not headless.

VMBindraban commented 6 years ago

image

VMBindraban commented 6 years ago

I had multiple instances of aurelia-pal in my project, 1.50 and 1.80. Setting the version explicit to 1.80 fixes it.