ActionScript的OAuth官方開發包 - ActionScript OAuth

jopen 12年前發布 | 66K 次閱讀 OAuth OAuth開發包

ActionScript OAuth 是 Adobe 官方的一個 ActionScript 編程語言的 OAuth 的開發包。兼容其他任何OAuth 2.0服務,像非死book平臺、Google APIs、推ter APIs以及其他服務。

// set up our StageWebView object to use our visible stage
stageWebView.stage = stage;

// set up the call
var oauth2:OAuth2 = new OAuth2("https://accounts.google.com/o/oauth2/auth", "https://accounts.google.com/o/oauth2/token", LogSetupLevel.ALL);
var grant:IGrantType = new AuthorizationCodeGrant(stageWebView,                     // the StageWebView object for which to display the user consent screen
                                                  "INSERT_CLIENT_ID_HERE",          // your client ID
                                                  "INSERT_CLIENT_SECRET_HERE",      // your client secret
                                                  "INSERT_REDIRECT_URI_HERE",       // your redirect URI
                                                  "INSERT_SCOPE_HERE",              // (optional) your scope
                                                  "INSERT_STATE_HERE");             // (optional) your state

// make the call
oauth2.addEventListener(GetAccessTokenEvent.TYPE, onGetAccessToken);
oauth2.getAccessToken(grant);

function onGetAccessToken(getAccessTokenEvent:GetAccessTokenEvent):void
{
    if (getAccessTokenEvent.errorCode == null && getAccessTokenEvent.errorMessage == null)
    {
        // success!
        trace("Your access token value is: " + getAccessTokenEvent.accessToken);
    }
    else
    {
        // fail :(
    }
}  // onGetAccessToken

項目主頁:http://www.baiduhome.net/lib/view/home/1338778033734

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!