Authenticating "manually" with Google Sign-in to obtain refresh_tokens #146
timfee
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've seen this question scattered about the internet, and wanted to share how I've approached this using this library. I'd love any feedback, and if there's enough interest, I can share a repo (or try my hand at a PR!)
Scenario:
I want to use Firebase Authentication with Google Signin as a provider, and want to be able to store a refresh_token (from
grantOfflineAccess()
) to do long-lived stuff on behalf of the user when they're not logged in. Unfortunately, with Firebase Auth, such functionality isn't natively supported with the current implementation of the Google Signin provider.Solution
I'm signing users in via
gapi
client-side functionality first, and then am using that credential tosignInWithCredential
. When I want to callgrantOfflineAccess
to collect acode
and store it, I'm able to do so with the help of a server-side function to do the code exchange.https://github.com/timfee/gapi-firebase
Beta Was this translation helpful? Give feedback.
All reactions