Open napafundi opened 4 years ago
Hi @napafundi , sorry for taking so long to get back to you.
Unfortunately I've not found much success with using the CookieStore
, Cognito and Fastboot. The biggest issue is that the JWT created by Cognito is too large to be stored in the cookie store.
I'm not sure what is causing the restore to be rejected -- you can try debugging into the authenticator's restore
method to see. But I suspect it has something to do with the issues of the cookie being too large.
@napafundi as a workaround you can do:
export default class IndexRoute extends Route {
@service fastboot;
@service session;
beforeModel(transition) {
if (!this.fastboot.isFastBoot) {
this.session.requireAuthentication(transition, 'login');
}
}
}
Depending how you're running fastboot and what your needs are, having auth info may only be required when the regular app loads.
When using ember-cognito with fastboot, page refreshing logs the user out.
After refreshing, I get an error :
The authenticator "authenticator:cognito" rejected to restore the session - invalidating…
. This doesn't occur when fastboot is disabled. I'm using aCookieStore
as described in theember-simple-auth
docs as well as acurrent-user
service as described in docs here.