Ember-simple-auth: Not possible to change baseURL

Created on 25 Aug 2016  路  11Comments  路  Source: simplabs/ember-simple-auth

In the initializer this code overwrites a custom baseURL set by end-users.

const config   = ENV['ember-simple-auth'] || {};
config.baseURL = ENV.baseURL;
Configuration.load(config);

In new versions of Ember, baseURL is undefined so it is additionally overwritten with an undefined value. See https://github.com/simplabs/ember-simple-auth/issues/1048

bug

All 11 comments

@gauthierm any work around you did till this get resolved?

@sumitramteke In my authenticator class I used this instead of the baseURL:

serverTokenEndpoint: Configuration['ember-simple-auth'].serverTokenEndpoint

It's a new config property I defined in my Ember config.

+1

apparently window.location.replace(undefined); makes safari and chrome (osx) crash hard...

This has been fixed by #1070.

@marcoow Sorry to bump and old thread, but there still isn't a way to override the baseURL used by ember simple auth in cases where you don't want it to be the routeURL.

In my ember app (for various reasons I won't bore you with) I have a separate routerRouteURL and routeURL for ember simple auth, I'd want to use the routerRouteURL not routeURL, but I can't as #1070 hard codes the base url as either routeURL or baseURL.

Is there a reason you don't allow baseURL to be customised?

I think we could offer customizability but that should be via a property on the ApplicationRouteMixin that defaults to the baseURL then:

urlAfterSessionInvalidation: Configuration.baseURL // there is probably a better name for this

@marcoow that approach sounds sensible do you want me to file this as a new issue?

do you want me to file this as a new issue?

PR adding that would be even better ;)

@marcoow would you have anything against also adding a config option routeAfterInvalidation which we could set this to default to config.baseUrl?

Naming wise would follow logically as you've got routeAfterAuthentication and routeIfAlreadyAuthenticated.

I'm not sure whether/how that's different from

urlAfterSessionInvalidation: Configuration.baseURL // there is probably a better name for this

? I think it's important to name the property url as opposed to route though as this is not an Ember route that we'll transitionTo but an URL and the app will be reloaded on that URL.

Was this page helpful?
0 / 5 - 0 ratings