最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - OAuth authentication like Facebook - Stack Overflow

programmeradmin0浏览0评论

I need to authenticate by OAuth to some sites (e. g. flickr) by Javascript and I want to make experience similar to what Facebook login-button does. When you click login-button a popup window is opened, you authenticate and then popup window is closed and onlogin event of login-button is raised.

Is there any Javascript library which implements this behavior for OAuth?

I need to authenticate by OAuth to some sites (e. g. flickr) by Javascript and I want to make experience similar to what Facebook login-button does. When you click login-button a popup window is opened, you authenticate and then popup window is closed and onlogin event of login-button is raised.

Is there any Javascript library which implements this behavior for OAuth?

Share Improve this question asked May 12, 2012 at 9:52 SiberianGuySiberianGuy 25.3k57 gold badges159 silver badges272 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 9 +100

This is a feature of OAuth 2.0, which specifies a client-side flow which facilitates this.

The spec is here and Google's implementation of it is described here.

Support for this is included in the google-api-javascript-client (for Google APIs and login) and there is a general library that will work with supported providers called gwt-oauth2 -- it's written in GWT, but is also usable in a standard JavaScript environment.

edit: Microsoft's Live Connect library appears to support this flavor of OAuth 2.0 as well.

Unfortunately, Flickr does not appear to have support for this, as it only seems to support OAuth 1.0a.

But there some popular providers that do support the client-side OAuth 2.0 flow:

  • Google
  • Facebook
  • Foursquare
  • Instagram
  • DailyMotion
  • Windows Live

You could run your own server to make OAuth 1.0a requests to Flickr and send back OAuth 2.0 access tokens to the JavaScript client, I suppose.

I am certain janrain offers authentication to sevaral sites using node.js, I would give it a peek. Also try this example

发布评论

评论列表(0)

  1. 暂无评论