yii2-authclient icon indicating copy to clipboard operation
yii2-authclient copied to clipboard

Get InvalidResponseException when refresh token expired

Open hiqsol opened this issue 6 years ago • 4 comments

What steps will reproduce the problem?

Wait until both access_token and refresh_token expire. Then try to login.

What do you get instead?

refresh

What's expected?

The token expiration is quite normal situation. Should not it finish somehow normally without exception?

What is recommended way to process this situation? I want to redirect user to login when this happens (refresh token expires).

Additional info

Q A
Yii version dev-master a741165
Yii Auth Client version 2.1.5
Yii HTTP Client version dev-master 33118fc
PHP version 7.1
Operating system some Debian in Docker in Ubuntu 16.04

hiqsol avatar Jun 15 '18 17:06 hiqsol

It should refresh the token, yes.

samdark avatar Jun 17 '18 20:06 samdark

It should refresh the token, yes.

No, it can't refresh anything cause refresh token is expired. AFAIU the library can't proceed with login in this situation. But I think it should not just throw connection level exception. Or it is ok?

If you use this extension how do you process this situation?

hiqsol avatar Jun 18 '18 08:06 hiqsol

Right. If the token is expired and we cannot refresh it, it's OK to throw an exception. Maybe domain-specific one such as RefreshTokenExpiredException. The exception should be caught at application level and, I guess, redirect user to login screen.

samdark avatar Jun 18 '18 10:06 samdark

I'm also interested in knowing how to properly process this situation. Where do we catch the exception? How do we force someone to re-authenticate via oauth (facebook)?

cleippi avatar Jun 18 '18 16:06 cleippi