Skip to content

Instantly share code, notes, and snippets.

@hallelujah
Created November 5, 2013 18:30
Show Gist options
  • Save hallelujah/7323725 to your computer and use it in GitHub Desktop.
Save hallelujah/7323725 to your computer and use it in GitHub Desktop.
A sample of how to handle ID.net SDK on Flash
import net.id.api.IDnet;
import net.id.api.core.IDnetURLDefaults;
import net.id.api.data.IDnetAuthResponse;
private var appId:String;
private function setAppIdAndInit(e:Event):void
{
var xml:XML = new XML(e.target.data);
setAppId(xml.appId);
IDnetURLDefaults.AUTH_URL = xml.authURL;
IDnetURLDefaults.API_URL = xml.apiURL;
IDnet.init(appId, handleInit, {status: true, redirect_uri:'http://localhost:4000'});
}
private function setAppId(appId:String):void
{
this.appId = appId;
}
private function init():void
{
readConfigAndInit();
}
private function handleInit(authResponse:IDnetAuthResponse, errorObj:Object):void
{
if (errorObj){
Alert.show("An error happens: " + encode(errorObj));
}
if (authResponse) {
currentState = "loggedIn";
var url:String = authResponse.details.avatars.medium_url;
updateAvatarImage(url);
getScores();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment