ember-simple-auth icon indicating copy to clipboard operation
ember-simple-auth copied to clipboard

refresh_token in fastboot mode

Open zion03 opened this issue 4 years ago • 1 comments

I'm trying load page from background using cookie as session storage . When access_token is expired but refresh_token is still valid everything works fine without fastboot (i. e. I'm get new access/refresh tokens using old (refresh) one ) In fastboot: fastboot server side part make query to token endpoint and get new access/refresh tokens after that client side repeat query to token endpoint with old data which was in cookie but not valid anymore and invalidate sesion. Is it a normal mode, bug or my misunderstanding. How to fix this problem.

I'm using oauth2-password-grant authenticator Env:

DEBUG: Ember             : 3.18.0
index.js:194 DEBUG: Ember Data        : 3.17.0
index.js:194 DEBUG: Ember Simple Auth : 3.0.0

Debug info: This case described for long live cookie

In restore we have refreshAccessTokens section with condition if (!isEmpty(data['expires_at']) && data['expires_at'] < now) So after executing this in Fastboot auth marked me as logged in, but after a while frontend processing logout.

When I modify this condition to: if (!isEmpty(data['expires_at']) && data['expires_at'] < now && !this.fastboot.isFastBoot) all tokens refresh and works as expected but without fastboot (with delay).

zion03 avatar Jun 14 '20 17:06 zion03

This sounds like a bug to me. Currently the FastBoot tests are disabled and we're working on re-enabling them (see #2209) – once that's done we should definitely create a test case for this to track down the error.

marcoow avatar Jun 17 '20 16:06 marcoow