GithubHelp home page GithubHelp logo

benpope82 / actionscript-oauth2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from charlesbihis/actionscript-oauth2

0.0 2.0 0.0 526 KB

An ActionScript 3 library for interfacing with OAuth 2.0 services.

Home Page: http://charlesbihis.github.io/actionscript-oauth2/

License: Other

ActionScript 100.00%

actionscript-oauth2's Introduction

ActionScript OAuth 2.0 Library

An ActionScript 3 library for interfacing with OAuth 2.0 services, implemented according to the OAuth 2.0 v2.15 specification.

Overview

This library is built for use with Flash/Flex/AIR projects to facilitate communication with OAuth 2.0 services. It provides mechanisms to authenticate against OAuth 2.0 servers using all standard authentication and authorization workflows.

This project was first mentioned in my blog post at http://blogs.adobe.com/charles/2012/05/oauth-2-0-library-for-actionscript.html.

Features

The ActionScript OAuth 2.0 Library supports the following features...

Dependencies

Reference

Usage

To use the library, simply drop in the SWC (or the source) into your project, along with the appropriate dependencies, and follow the usage below...

// 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

Demo

Documentation

You can find the full ASDocs for the project here.

Author

License

The ActionScript OAuth 2.0 Library is licensed under the Apache License, Version 2.0.

actionscript-oauth2's People

Contributors

charlesbihis avatar marcorei avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.