简体   繁体   English

带有自定义令牌的身份验证流程,用于云功能上的Firebase身份验证

[英]Authentication flow with custom token for Firebase Authentication on cloud functions

I'm creating a game in which I would like to use firebase authentication using cloud functions for logging in and registering users. 我正在创建一个游戏,其中我想使用Firebase身份验证和云功能来登录和注册用户。 Since my dev platform (GameMaker Studio 2) doesn't have the firebase sdk, I've resulted in attempting to use the firebase auth restAPI. 由于我的开发平台(GameMaker Studio 2)没有Firebase SDK,因此导致尝试使用Firebase auth restAPI。 To authenticate a user, I have to at one point create a custom token using the users uID and then use that to login. 要对用户进行身份验证,我必须使用用户的uID创建一个自定义令牌,然后使用该令牌登录。 The problem with this is that I can't really understand the flow of the authentication. 问题是我无法真正理解身份验证流程。 How could the client have knowledge beforehand on it's userID from parameters such as email and password? 客户如何通过诸如电子邮件和密码之类的参数事先了解其用户ID?

Any help in understanding the flow I need to authenticate a user will be greatly appreciated. 我们将非常感谢您在理解我需要认证用户的流程方面的任何帮助。

If you're developing on node.JS, you should be able to use npm to install the firebase package -- that would simplify things greatly. 如果您正在使用node.JS进行开发,则应该能够使用npm安装firebase软件包-这样可以大大简化事情。

Otherwise, the overall flow of authentication should look as follows. 否则,身份验证的总体流程应如下所示。

  1. Client gives email and password 客户提供电子邮件和密码
  2. Pass email & password to Firebase Authentication using your HTTP request. 使用您的HTTP请求将电子邮件和密码传递给Firebase身份验证。 You should receive an auth token, and a uID if authentication was successful. 您应该收到一个身份验证令牌和一个uID(如果身份验证成功)。 ( see here ) 见这里
  3. Now you have an id token that you can set as a cookie in your client's browser. 现在,您有了一个ID令牌,可以将其设置为客户端浏览器中的cookie。 You can verify this cookie by storing it in your backend for each subsequent GET request to your Node server. 您可以通过将Cookie存储在后端中,以便随后向节点服务器发送每个GET请求来验证该Cookie。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase自定义令牌身份验证(firebase版本3) - Firebase custom token authentication (firebase version 3) 在 Cloud Functions 中无法进行 firebase 身份验证 - In Cloud Functions not able to do firebase authentication Firebase 身份验证访问令牌失败,使用身份验证自定义令牌创建令牌 - Firebase Authentication Access Token failed, Token created with auth custom token Firebase身份验证与Cloud SQL混合 - Firebase Authentication mixed with cloud sql Firebase 多重身份验证触发函数 - Firebase Multiple Authentication triggered functions Firebase和平均堆栈体系结构的身份验证流程是什么? - what is the authentication flow for a firebase and mean stack architecture? 发送身份验证承载令牌时出现 Cors 策略错误 - node.js(谷歌云函数) - Cors Policy Error when sending Authentication Bearer token - node.js (Google cloud functions) 有没有办法保护 Firebase 云函数在未经用户身份验证的情况下被入侵者调用? - Is there a way to protect Firebase Cloud Functions being called from intruders without user authentication? Cloud Container Builder身份验证令牌问题 - Cloud Container Builder authentication token issue 如何在 Firebase 身份验证中正确验证令牌 - How to properly verify a token in Firebase Authentication
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM