我的 Web Apps API 需要 Oauth2 吗 [英] Do I need Oauth2 For my Web Apps API

查看:19
本文介绍了我的 Web Apps API 需要 Oauth2 吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力构建一个基于 express.js/node.js 的 REST API.我有几个问题...

I am trying to wrap my brain around building an express.js / node.js based REST API. I have a couple of questions...

  1. 如果我现在只关心网络应用程序(不一定是手机应用程序),我是否需要基于令牌/oauth 1 或 2 的安全性来保护我的 API

  1. Do I NEED token based / oauth 1 or 2 security for my api if I'm only concerned about a web application right now (not necessarily phone apps)

是否有任何资源可以学习如何从头开始构建?我已经从字面上阅读了谷歌搜索rest api with oauth2 authentication express.js"的前 3 页,但我仍然没有掌握它.

Are there any resources to learn how to build this from scratch? I've read literally the first 3 pages of googling "rest api with oauth2 authentication express.js" and i'm still not grasping it.

推荐答案

你想在 node.js 中做一个 REST API 很好.它在构建基于 API 的请求方面非常出色.

Its good that you want to do a REST API in node. Its really good in building API based request.

对于您的问题:

  1. 如果您只是构建一个基本 API,使用简单的 GET 和 POST 请求,那么您可能想问问自己,您正在显示或操作的数据是否需要安全性".如果不是,那么很可能您不需要实施 OAuth.

但是如果您的数据是敏感的,例如私人用户数据,那么您需要在 API 上放置某种安全层.此外,使用 OAuth 或其他基于令牌的安全性可以帮助您在整个用户群中建立更好的权限检查.

But if your data is sensitive, such as private user data, then you need to put some sort of security layer on your API. Also, using OAuth or other token based security can help you build a better permission checking across your user base.

  1. 您首先需要掌握 OAuth 的概念.一旦您了解了 OAuth 的工作原理,就可以很容易地以您选择的语言实现.这里有一些关于如何更好地理解 OAuth 的好读物

http://www.slideshare.net/MindfireSolutions/oauth-and-rest?qid=09a7d224-78bb-4b47-8957-3f0a0ce809a4&v=qf1&b=&from_search=3

有关 OAuth 的更多详细信息:https://www.rfc-editor.org/rfc/rfc6749

For more detailed info about OAuth: https://www.rfc-editor.org/rfc/rfc6749

同样,一旦您了解了 OAuth 的工作流程,就可以轻松实现它.:P

Again, once you understand the workflow of OAuth, you can implement it easily. :P

这篇关于我的 Web Apps API 需要 Oauth2 吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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