Javascript を使用して一部のサイト (flickr など) に対して OAuth で認証する必要があり、Facebook のログイン ボタンと同様のエクスペリエンスを実現したいと考えています。ログイン ボタンをクリックすると、ポップアップ ウィンドウが開き、認証が行われ、ポップアップ ウィンドウが閉じられ、ログイン ボタンの onlogin イベントが発生します。
OAuth にこの動作を実装する Javascript ライブラリはありますか?
Javascript を使用して一部のサイト (flickr など) に対して OAuth で認証する必要があり、Facebook のログイン ボタンと同様のエクスペリエンスを実現したいと考えています。ログイン ボタンをクリックすると、ポップアップ ウィンドウが開き、認証が行われ、ポップアップ ウィンドウが閉じられ、ログイン ボタンの onlogin イベントが発生します。
OAuth にこの動作を実装する Javascript ライブラリはありますか?
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:
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.