检查用户是否从后端Firebase身份验证登录 [英] Check if user logged in from backend Firebase Authentication

查看:102
本文介绍了检查用户是否从后端Firebase身份验证登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的前端中,用户使用Firebase身份验证浏览器登录.那部分工作得很好.除了Firebase后端外,我还具有提供其他内容的NodeJS后端.但是,我只需要将内容提供给经过身份验证的用户.

In my frontend, the user logs in using Firebase Authentication Browser. That part works perfectly fine. In addition to Firebase backend, I also have NodeJS backend that serves additional content. However, I need to serve the content to only Authenticated user.

我的问题是:我的NodeJS后端是否可以通过某种方式知道用户在发出请求时已通过身份验证?

My question is: Is there a way for my NodeJS backend to know that a user has been authenticated when they make a request?

推荐答案

已通过身份验证的客户端将获得获取此令牌.然后,它可以将该令牌传递给外部API,该API 使用以下方法验证令牌Admin SDK .

An authenticated client is issued an ID token that uniquely identifies the user. The client can get this this token using the provided API. Then, it can pass that token to external APIs, which is verify the token using the Admin SDK.

这篇关于检查用户是否从后端Firebase身份验证登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆