如何在客户端使用Firebase认证gmail来保护NestJS中的API ?



我们如何保护NestJS API端点?

Android Native Application with Firebase Gmail Auth.

服务器

包含ExpressJS, TypeORM,MySQL的NestJS框架

我们的用户通过Firebase认证"Google认证提供商"获取UID并存储在服务器上。如何保护POST端点。

有效载荷

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

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

感谢

你应该阅读一下关于NestJS中的身份验证的章节,并使用Passport,这会使你的工作变得容易。

最新更新