ActionScript的OAuth官方开发包 - ActionScript OAuth
jopen
12年前
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