Bitwise
Bitwise

Reputation: 8451

Redirect if already authenticated - ember simple auth

I have registration and login working for my Ember app but for some reason 'routeIfAlreadyAuthenticated' is not working currently. Here is my setup:

config/environment.js

'ember-simple-auth': {
  authenticationRoute: 'auth.login',
  routeIfAlreadyAuthenticated: 'rows',
  routeAfterAuthentication: 'rows'
}

But if I go to say /auth/login after I'm signed in it doesn't redirect me to the rows route. Does anybody know what I could be doing wrong?

Upvotes: 1

Views: 133

Answers (1)

Joe Hany
Joe Hany

Reputation: 1015

Your login route should extend unauthenticated-route-mixin mixin:

import Route from '@ember/routing/route';
import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';

export default Route.extend(UnauthenticatedRouteMixin, {
});

Upvotes: 3

Related Questions