ember-cognito
ember-cognito copied to clipboard
Issue integrating with fastboot
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 a CookieStore as described in the ember-simple-auth docs as well as a current-user service as described in docs here.
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.