【问题标题】:How to secure the API in NestJS, using Firebase Auth gmail in Client?如何在客户端中使用 Firebase Auth gmail 保护 NestJS 中的 API?
【发布时间】:2021-06-09 04:28:11
【问题描述】:

我们如何保护 NestJS API 端点?

客户

带有 Firebase Gmail 身份验证的 Android 原生应用程序。

服务器

带有 ExpressJS、TypeORM、MySQL 的 NestJS 框架

我们的用户通过 Firebase Auth“Google Auth Provider”进行身份验证并获取 UID 并将其存储在服务器上。如何保护 POST 端点。

有效载荷

{
  "uid":"adsfasdfasdfas",
  "name":"John",
  "email":"email@example.com",
  "token":"XZExzs2511WSSkl" // How to make this token, and can be validate in Server
}

请建议,有什么好的方法?

谢谢

【问题讨论】:

标签: android firebase-authentication jwt nestjs restful-authentication


【解决方案1】:

您应该阅读 Authentication in NestJS 上的章节,并使用 Passport 让您的工作变得轻松。

【讨论】:

    猜你喜欢
    • 2021-02-20
    • 1970-01-01
    • 2013-11-29
    • 2020-07-11
    • 1970-01-01
    • 2022-01-01
    • 2012-04-24
    • 2022-10-01
    • 1970-01-01
    相关资源
    最近更新 更多