Actionscript Oauth2 is a library for interfacing with OAuth 2.0 services. It provides mechanisms to authenticate against OAuth 2.0 servers using all standard authentication and authorization workflows.
Some features:
- Ability to fetch an access token via the OAuth 2.0 supported workflows…
- Ability to refresh an access token
- Robust and adjustable logging
- Ability to log in, view, and interact with the user consent page within a given
StageWebView
object
Sample
// 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
RT @as3gamegears New: Actionscript Oauth2 (lib for interfacing with OAuth 2.0 services) http://t.co/yWyEqBTM #as3 #gamedev
RT @michelleyaiser: RT @as3gamegears: New: Actionscript Oauth2 (lib for interfacing with OAuth 2.0 services) http://t.co/kOFahbor #as3…
[…] OAuth2 is a re-write/refactor of the Adobe AS3 OAuth2 library written by Charles Bihis. The app auth flow has been decoupled to remove the Air dependencies and […]