Auth0 offers a "Hosted Page" section on their Dashboard which allows you to create simple and custom login pages. I would like my application to redirect to this login page when a user is unauthenticated. However no matter what I do, it defaults to the base login screen.
The thing is, the hosted login in page is working, but I can't connect it to my application. If I go to the link I am able to see the login page but from the application itself, it will not redirect to this page.
Here is my application/route.js code:
import Ember from 'ember';
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
const { Route, get, set} = Ember;
export default Route.extend(ApplicationRouteMixin, {
beforeModel(transition) {
let session = get(this, 'session');
if (!get(session, 'isAuthenticated')) {
transition.abort();
set(session, 'attemptedTransition', transition);
transition.send('login');
}
},
afterModel() {
this.transitionTo('customer-master');
},
actions: {
login() {
let lockOptions = { authParams: { scope: 'openid' } };
get(this, 'session').authenticate('simple-auth-authenticator:lock', lockOptions);
},
logout() {
get(this, 'session').invalidate();
}
}
});
And here is the environment.js code:
ENV['ember-simple-auth'] = {
authenticationRoute: 'index',
routeAfterAuthentication: 'customer-master',
routeIfAlreadyAuthenticated: 'customer-master'
};
ENV['auth0-ember-simple-auth'] = {
clientID: "obfuscated",
domain: "obfuscated"
}
ENV['contentSecurityPolicy'] = {
'font-src': "'self' data: https://cdn.auth0.com",
'style-src': "'self' 'unsafe-inline'",
'script-src': "'self' 'unsafe-eval' 'unsafe-inline' https://cdn.auth0.com",
'connect-src': "'self' http://localhost:* obfuscated"
};
I was able to go to the custom login page directly and get it to then redirect to my application, but the user arrived there unauthenticated. That of course is a separate issue but I am able to redirect from the Custom Login -> Application, but not Application -> Custom Login. Login / Logout are both functioning as expected, I simply miss this final link.
Please let me know if you have any suggestions. I've spent quite some time and to no avail.
Aucun commentaire:
Enregistrer un commentaire