将Android Firebase Auth用户安全地存储在MySQL数据库中 [英] Securely store Android Firebase Auth users in a MySQL database

查看:161
本文介绍了将Android Firebase Auth用户安全地存储在MySQL数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个Android本机应用程序,并且正在将Firebase Auth与多个auth提供一起使用,例如;电子邮件,Facebook,Google等,我将使用Firebase SDK进行聊天和实时数据库.

I am creating an Android native app and I am using Firebase Auth with multiple auth provides such as; Email, Facebook, Google etc, I will use the Firebase SDK for chat and real-time DB.

我有一个带有MySQL的RESTful API(类似于Facebook,有一个朋友,私人和公开帖子),一个PHP服务器背后的用户数据库,我想同步Auth,以便确保用户正确并有权访问他们拥有权限的数据.我可以编辑和更改数据库,因此可以根据此处的建议进行修改.

I have a RESTful API with a MySQL (similar to Facebook with; friends, private and public posts), a user database behind a PHP server and I would like to synchronize the Auth so that I can ensure that the user is correct and has a authority to access data for which they have permissions. I am able to edit and change my database so I can adapt it to suggestions here.

(我原本以为可能需要OAuth之类的东西,但我不再认为这是必需的)

经过大量研究,我认为我需要安全地将用户电子邮件和Firebase Auth令牌传达给MySQL,同时保持详细信息同步吗?看来这将是很普遍的事情,但我还没有找到确切的答案.

After much research, I think that I need to securely communicate the users email and the Firebase Auth token to the MySQL whilst keeping details in sync? It seems like this would be something that would be quite common but I haven't been able to find a definitive answer.

(如果上述说法正确)

我的问题是:

  • 是通过服务器对用户进行身份验证所需的全部电子邮件和身份验证令牌
  • 是否应使用PHP SDK将Auth令牌发送到Firebase SDK
  • 关于安全性,凭据应如何存储在MySQL数据库中
  • Auth令牌如何过期和/或刷新
  • 如何将信息从Android客户端安全地发送到MySQL数据库
  • 更新Auth令牌的正确过程和策略是什么
  • 什么是正确的Auth详细信息同步策略,例如客户端和服务器之间的电子邮件地址和令牌
  • 我在正确的轨道上吗:)

我是大多数Auth概念的新手.

I'm new to most Auth concepts.

最诚挚的问候

推荐答案

  1. 是通过服务器对用户进行身份验证所需的全部电子邮件和身份验证令牌:您只需要身份验证ID令牌即可.您可以从中获取电子邮件.您需要在每次将ID令牌发送到您的服务器时对其进行验证.检查 https://firebase.google.com/docs/auth/admin/verify-id-tokens#verify_id_tokens_using_a_third-party_jwt_library

是否应该使用PHP SDK将Auth令牌发送到Firebase SDK:反之亦然.该ID令牌位于客户端,您可以调用getIdToken,然后将其发送到您的后端服务器.

Should the Auth token get sent to Firebase SDK using the PHP SDK: It is the other way round. The ID token is on the client side, you call getIdToken and then send it to your backend server.

关于安全性,凭据应如何存储在MySQL数据库中:您无需在数据库中存储凭据.您可以存储会话信息,但是凭据是在客户端上生成和刷新的.

How should credentials be stored in the MySQL DB with regards to security: You don't need to store credentials in your DB. you can store session information, but the credentials are generated and refreshed on the client.

这篇关于将Android Firebase Auth用户安全地存储在MySQL数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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