Firebase token management in servers

こ雲淡風輕ζ 提交于 2019-12-02 12:21:11

The Firebase documentation on monitoring the token enumerates the reasons:

The registration token may change when:

  • The app deletes Instance ID
  • The app is restored on a new device
  • The user uninstalls/reinstall the app
  • The user clears app data.

Beyond deleting the token (the first option above), you have no control over when a token is refreshed. But unlike Firebase Authentication tokens, the Instance ID Tokens of Firebase Cloud Messaging don't refresh on a fixed schedule. Instance ID Token refreshes are relatively rare and should only need special considering for scaling out in the largest use-cases.

Nope. There is no way to just refresh the expiration of a registration token.

When a registration token is refreshed, the token value will change. The event when the registration token itself will expire is indefinite as well and can only happen on specific events as specified in the FirebaseInstanceId docs:

Instance ID is stable except when:

  • App deletes Instance ID
  • App is restored on a new device
  • User uninstalls/reinstall the app
  • User clears app data

In the above cases a new Instance ID is generated and the application needs to recreate the authorization tokens previously generated implementing onTokenRefresh().

And as already mentioned above, in the event where a token is refreshed, onTokenRefresh() will be called and that you should handle the next steps on sending it to your App Server and deleting the old token that got expired and some other stuff.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!