Firebase Admin SDK - Current Logged In User - Nodejs

时光怂恿深爱的人放手 提交于 2019-12-03 20:28:32

The Firebase Admin SDK does not inherently know what user is using your Express web app. You will need to implement code for this. If you're already using Firebase Authentication in the web app, this takes these steps:

  1. Retrieve the user's ID token on the client

    You can get a user's ID token by using the firebase.auth().currentUser.getIdToken() method.

  2. Pass this token from the client to the server

  3. Verify the token on the server

    The user ID token can be verified using the admin.auth().verifyIdToken(idToken) method. On success it will return a promise with the decodedToken, otherwise it will return a rejected promise.

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