使用登录名/密码和其他社交网络实现身份验证的更好方法是什么? [英] Which is the better way to implement authentication using login/password AND other social networks?

查看:44
本文介绍了使用登录名/密码和其他社交网络实现身份验证的更好方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将尝试解释我的问题:

I'm gonna try to explain my problem :

我希望允许用户通过他们自己的帐户(登录名/密码)或通过社交网络(首先是 Facebook)连接到我的 api.

I'd like to allow users to connect to my api via their own accounts (login/password) or via a social network (Facebook at first).

然后,我将允许任何应用程序使用我的 api,并且用户经过身份验证.

Then, I would allow any application to use my api, with the user authenticated.

我的第一个想法是何时通过用户的登录名/密码对用户进行身份验证并返回用作下一个请求的会话的令牌.

My first thought when to auth the user via his/her login/password and return a token used as the session for the next requests.

但 OAuth 似乎是更好的实现,除非我不知道如何做到这一点:

But OAuth would seems to be the better implementations, except I don't know how to do this :

  • 我的一个应用程序必须通过登录名/密码进行连接,例如 twitter web(如果我不想让我的用户登录,我必须在某处实现登录名/密码身份验证:p)
  • 我是否还必须将我的应用程序注册到 oauth 系统(twitter 是否将他们的网络应用程序添加到了他们的 oauth 中?)
  • 如何通过其他社交网络合并身份验证.具体来说,用户必须对我的 api 进行 OAuth,以便对社交网络进行身份验证.

我对如何做到这一点有点迷茫,如果有人能帮助我,我将不胜感激!

I'm a bit lost on how to do this, if someone could help me, I would really appreciate !

谢谢

更新 1:Flickr 和 Lastfm 似乎不使用 OAuth,而是使用如下所示的替代身份验证系统:

Update 1: Flickr and Lastfm seems to not use OAuth but an alternative auth system that looks like this :

  • 用户被重定向到 Flickr/Lastfm
  • 用户对自己进行身份验证并接受使用该应用程序
  • Flickr/Lastfm 使用临时 frob(对于 flickr)或令牌(对于 lastfm)返回回调 URL
  • 应用必须使用临时 frob/token(以及 api_key 和 api_sig,一如既往)调用提供者,并返回会话令牌以用于下一次调用.

更新 2:事实上,StackApps 是我的问题的具体案例:您可以通过他们的登录名/密码系统或 openId 登录,并且您可以使用他们的 API.

Update 2: In fact, StackApps is the concrete case of my problem : you can login through their login/password system OR openId, and you can use their API.

推荐答案

OAuth 只需要让其他人在其他服务上使用您的 API,即授权服务使用您的 API,而中间服务的用户无需通过将用户的登录凭据提供给第三方来明确登录您的服务.

OAuth is only needed to make others use your API on other services, i.e. authorize services to use your API without users of the intermediary service explicitly having to log in into your service by giving user's login credentials to a third party.

我认为您需要的是OpenID,跨应用程序身份验证 机制.您只需要实现一个 OpenID 客户端,接受第三方 OpenID 来对用户进行身份验证,然后在他们使用您的服务的 API 时识别他们.这必须辅以正常的本地"用户身份验证机制(即登录/密码输入页面)

What I think you need is OpenID, the cross-application authentication mechanism. You just need to implement an OpenID client, accepting third-party OpenIDs to authenticate users, to subsequently identify them, when they use your service's API. This would have to be supplemented with a normal 'local' user authentication mechanism (i.e. login/password entry page)

不过,您将需要 OAuth 来提供在其他网站上使用您的 API 的能力.

You will need OAuth to provide an ability to use your API on other sites, though.

这篇关于使用登录名/密码和其他社交网络实现身份验证的更好方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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