使用 Firebase OAuth 保护 RESTful API? [英] Securing RESTful API with Firebase OAuth?

查看:56
本文介绍了使用 Firebase OAuth 保护 RESTful API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 iOS 和网络应用中使用 Firebase 来处理用户身份验证.我需要确保用户已登录,然后才能向我的 API 发出任何请求.我将如何使用 Firebase 完成这样的事情?

I'm using Firebase in my iOS and web app to handle user authentication. I need to make sure a user is logged in before he can make any requests to my API. How would I accomplish such a thing with Firebase?

我正在考虑使用 Kong - https://getkong.org - 作为我的 API 的中间人.Kong 有几个与验证传入请求相关的选项 - https://getkong.org/plugins.Firebase 有什么用?JWT认证?OAuth 身份验证?密钥认证?

I'm thinking about using Kong - https://getkong.org - as a middleman for my API. Kong has a few options in relation to authenticating incoming requests - https://getkong.org/plugins. What would work with Firebase? JWT authentication? OAuth authentication? Key authentication?

您能指出一个基本示例的方向吗?或者给我一个关于我应该寻找什么的基本概述?

Can you point me in the direction of a basic example? Or give me a basic overview of what I should be looking for?

推荐答案

我最终验证了用户令牌服务器端,如下所示:

I ended up authentication the users token server-side, like this:

https://gist.github.com/holgersindbaek/2cc55efd89517e241fbb512a

https://gist.github.com/holgersindbaek/2cc55efd89517e21fbb52b4e95125003

这篇关于使用 Firebase OAuth 保护 RESTful API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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