You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With Google you only get one shot (one opportunity) to get a refresh_token. Performing a new authentication sets refresh_token to nil. No good :)
strategies do
oauth2 :google do
identity_resource Knowb.Accounts.Identity
client_id Knowb.GoogleAuthSecrets
client_secret Knowb.GoogleAuthSecrets
redirect_uri Knowb.GoogleAuthSecrets
site Knowb.GoogleAuthSecrets
authorize_url "https://accounts.google.com/o/oauth2/auth"
token_url "https://accounts.google.com/o/oauth2/token"
user_url "https://www.googleapis.com/oauth2/v1/userinfo"
authorization_params(
scope:
[
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile"
]
|> Enum.join(" "),
access_type: "offline",
prompt: "select_account"
)
end
end
Setting access_type: "offline" is needed to get a refresh_token from Google. If we do not save it the subsequent logins will only produce access_token and refresh_token will be nil. I can revoke the app access here and logging in after that will get me a new refreh_token. But that's not particularly tenable for users.
The need for the refresh_token is fundamentally to not have to run a separate Google integration to make API calls on behalf of the user even after their session has perhaps lapsed. I am planning to feed it to Goth and do a bunch of Google stuff.
Killing the refresh token on logging in again is a problem for that.
The text was updated successfully, but these errors were encountered:
Yeah, I note that now that the Google strategy has been merged the recent addition of the oauth2 strategy with google guide is now a lie. Perhaps you and/or @Sam23D could come up with a doc update for the status of Google including the knowledge in this issue and we can then close it?
With Google you only get one shot (one opportunity) to get a refresh_token. Performing a new authentication sets refresh_token to nil. No good :)
Setting
access_type: "offline"
is needed to get a refresh_token from Google. If we do not save it the subsequent logins will only produce access_token and refresh_token will be nil. I can revoke the app access here and logging in after that will get me a new refreh_token. But that's not particularly tenable for users.The need for the refresh_token is fundamentally to not have to run a separate Google integration to make API calls on behalf of the user even after their session has perhaps lapsed. I am planning to feed it to Goth and do a bunch of Google stuff.
Killing the refresh token on logging in again is a problem for that.
The text was updated successfully, but these errors were encountered: