每次站点访问时进行 oAuth 身份验证
我正在尝试为我正在创建的 Web 应用程序实现临时 oAuth 身份验证。本质上,用户每次访问我的网络应用程序时都需要登录服务。主要是为了能够使用网络应用程序,而无需存储任何用户的身份验证数据。我正在尝试使用 Tumblr API。
我选择的平台是 PHP。不过,我以前从未真正使用过 oAuth,并且仍在学习中。以下场景说明了我想要实现的目标:
该场景假设:
- 用户已在其 Tumblr 帐户中授权我的应用程序。
- 使用我的 Tumblr 消费者密钥、Tumblr 消费者秘密,我调用以获取 request_token,稍后通过链接将其显示给用户。
- 现在,点击上面的链接后,我希望 Tumblr 不会再次要求用户允许该应用程序(在他们的帐户中授权),而只是将用户重定向回来并返回一些信息,以便我区分用户。当用户尝试使用 Tumblr 登录网站时,没有 $_SESSION
这可能吗?如果是的话,你能帮我弄清楚如何完成这件事吗?
诗。我是一个彻底的 oAuth Noob,所以请温柔一点:)
I'm trying to implement a transient oAuth authentication for a web app I'm creating. Essentially, the user needs to login with the Service each time they visit my web app. Primarily it's to enable using the web app without me having to store any of the user's authentication data. I'm trying to use the Tumblr API.
My platform of choice is PHP. However I've never really worked with oAuth before and and am still learning. The following scenario illustrates what I'm trying to achieve:
The scenario assumes that:
- The user has already authorized my application in their Tumblr account.
- Using my Tumblr Consumer Key, Tumblr Consumer Secret, I call to get request_token, which I later display to the user via a link.
- Now on clicking the link above, I expect Tumblr to NOT to ask user to allow the app again (authorize in their account) and simply redirect user back and returning some info that will allow me to distinguish the user. There is no $_SESSION as user is trying login to the website using Tumblr
Is this even possible? If yes, can you help me figure out how to get this done?
Ps. I'm a complete oAuth Noob so please be gentle :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您尝试以类似于 Facebook Connect 的方式使用 Tumblr,Tumblr 目前不提供此功能。即:您无法使用 Tumblr 登录您的网站。
Tumblr 的 OAuth 实现将允许您让用户允许您的应用程序无限期地访问用户帐户。这意味着您的应用程序始终能够访问用户帐户,无论他们是否登录到您的网站。他们每次想要访问您的应用程序时仍然需要登录您的网站。
这是 OAuth 的可靠指南。 Tumblr 使用 OAuth 1.0 :
http://hueniverse.com/oauth/
If you are trying to use Tumblr in a way similar to Facebook Connect, Tumblr does not offer this feature at the moment. ie: you can not use Tumblr to log into your site.
Tumblr's OAuth implementation will allow you to have the user allow access for your app to the users account indefinitely. Which means that your app will always be able to access the users account, whether they are logged into your site or not. They will still have to log into your site each time they want to access your app.
Here is a solid guide to OAuth. Tumblr uses OAuth 1.0 :
http://hueniverse.com/oauth/