Created
November 5, 2013 18:30
-
-
Save hallelujah/7323725 to your computer and use it in GitHub Desktop.
A sample of how to handle ID.net SDK on Flash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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