+ *
+ * @alias X.OAuth2
+ * @class OAuth2 サービスを定義し接続状況をモニタする。適宜にトークンのアップデートなどを行う
+ * @constructs OAuth2
+ * @extends {EventDispatcher}
+ * @example // OAuth2 サービスの定義
+oauth2 = X.OAuth2({
+ 'clientID' : 'xxxxxxxx.apps.googleusercontent.com',
+ 'clientSecret' : 'xxxxxxxx',
+ 'authorizeEndpoint' : 'https://accounts.google.com/o/oauth2/auth',
+ 'tokenEndpoint' : 'https://accounts.google.com/o/oauth2/token',
+ 'redirectURI' : X.URL.cleanup( document.location.href ), // 専用の軽量ページを用意してもよいが、現在のアドレスでも可能
+ 'scopes' : [ 'https://www.googleapis.com/auth/blogger' ],
+ 'authorizeWindowWidth' : 500,
+ 'authorizeWindowHeight' : 500
+}).listen( [ X.Event.NEED_AUTH, X.Event.CANCELED, X.Event.SUCCESS, X.Event.ERROR, X.Event.PROGRESS ], updateOAuth2State );
+
+// XHR 時に oauth2 を渡す
+X.Net( {
+ xhr : 'https://www.googleapis.com/blogger/v3/users/self/blogs',
+ dataType : 'json',
+ auth : oauth2,
+ test : 'gadget' // http -> https:xProtocol なリクエストのため、google ガジェットを proxy に使用
+ } )
+ .listen( [ X.Event.SUCCESS, X.Event.ERROR, X.Event.PROGRESS ], updateOAuth2State );