且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何验证由createCustomToken()创建的自定义Firebase身份验证令牌

更新时间:2023-10-13 20:50:34

verifyIdToken就像名称是用来验证IdToken,而不是自定义标记.

verifyIdToken like the name is to verify IdToken, not custom token.

CustomToken用于sign in的客户端.可以使用简单的JWT验证(如您的解决方案)来验证此自定义令牌(一小时后失效).

CustomToken is for client to sign in. This custom token can be verify using simple JWT verification like your solution (it expire after one hour).

但是IdToken是另一回事,您需要使用firebase auth进行登录过程.

But the IdToken is another story, you need to do sign in process using firebase auth.

在登录后从客户端获取Id Token ,这取决于客户端是Android,Web还是IOS. 可以在此部分中阅读获取IdToken的代码.

To Get The Id Token from client after signIn, it's depend whether the client is Android, Web, or IOS. The code to get the IdToken can be read in this section