Using REST API and how to refresh token

1,513 views
Skip to first unread message

jeff...@zappoint.com

unread,
Mar 10, 2017, 10:58:14 AM3/10/17
to Firebase Google Group
Hi all,

Use Case: Use firebase inside China
Because China's GFW blocked all google service endpoints.
We cannot use any firebase SDKs directly which will be failed when auth with google platforms.

Instead, we build our own API server as proxy and get auth user from our server to firebase services.
case 1. create user.
-> user signup with email/password via admin.auth().createUser() on our API server
case 2. user login.
-> user login with email/password via  firebase.auth().signInWithEmailAndPassword()  on our API server
-> client will get accessToken and refreshToken info
case 3. use firebase REST API
-> now, we can use firebase service via the accessToken

Issue.
Before the accessToken is expired in 1 hour, I have no way to refresh the token for user.
Try 1: firebase.auth().currentUser.getToken(true)
-> not worked, because the client is not auth-ed, there is no currentUser
Try 2: pass the the accessToken and refreshToken to our API server 
-> But I have no idea how to refresh auth token via nodejs SDK. There is no API for this use case.

Is there any guide about how to refresh token via API, or any way to make the expiration time of accessToken much longer ?

Thanks,
Jeff Huang

jeff...@zappoint.com

unread,
Mar 17, 2017, 10:27:39 AM3/17/17
to Firebase Google Group
Update!

Figure out can refresh_token by following guide:

Regards,
Jeff Huang
Reply all
Reply to author
Forward
0 new messages