【发布时间】: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
}
请建议,有什么好的方法?
谢谢
【问题讨论】:
-
您可以使用 Auth Guard docs.nestjs.com/guards#authorization-guard
标签: android firebase-authentication jwt nestjs restful-authentication