Tal Shani
Tal Shani

Reputation: 690

What is the different between getRefreshToken() to iid().getToken() in Firebase?

I have a question about firebase... recently I see that

app.messaging().getRefreshToken() 

didn't call every time and I understand why but if I want anyway to call it every time. so calling to

app.iid().getToken() 

is equivalent to getRefreshToken()?

If not what is the different between them?

Thank you

Upvotes: 2

Views: 95

Answers (1)

Pritish Vaidya
Pritish Vaidya

Reputation: 22189

Although I don't see the getRefreshToken() in the docs but the below explanation should help.

getToken(forceRefresh): getToken method returns a JWT token to identify the user.

It returns the current token if it has not expired, otherwise this will refresh the token and return a new one.

If you use forceRefresh: true, it will always return a refreshed token regardless of expiration.

app.iid().getToken(true) will fetch the refreshed token.

Upvotes: 1

Related Questions