dnplus / streamlit-oauth

Simple OAuth Component for Streamlit App
MIT License
144 stars 23 forks source link

FYI After invoken refresh, Refrestoken is no longer present, workarround #40

Closed DaRutSki closed 4 months ago

DaRutSki commented 4 months ago

First of all thank you for writing this component !

I used it and was wondering if I am doing something wrong,

I use the version 0.1.8

and i got this as a result after refresh with force=True. After the call the refresh token is gone, my solution is to recycle the refresh_token as it is longer lived, but was wondering of this was the correct behaviour

{ "access_token":"ya29 ..." "expires_in":3599 "refresh_token":" ... " "scope":"https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid" "token_type":"Bearer" "id_token":"..." "expires_at":1716970053 } token after refresh, force=True

{ "access_token":"ya29 ..." "expires_in":3599 "scope":"openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email" "token_type":"Bearer" "id_token":"id" "expires_at":1716970065 }

dnplus commented 4 months ago

Hi @DaRutSki

It's expected behavior for google

Google OAuth uses the same refresh token issued from the first time

It will not return refresh token for every token exchange like another do

So, you need to keep the refresh token in separate session state and put it back after exchange