Answer the question
In order to leave comments, you need to log in
How to get access_token VK and FB (FLASH AIR)?
How to get access_token VK, FB from under AIR application?
Answer the question
In order to leave comments, you need to log in
As always, I have to answer my own question...
I had to do everything in a native way, because the developers do not want to make an ANE extension for AIR applications.
FOR VK
Create a sprite object or a button on click, make an event
Create 2 constants for the link to quickly edit the config...
const
VK_APP_ID:Number = 1,
VK_URL_AUTH:String = 'https://oauth.vk.com/authorize?client_id='+VK_APP_ID+'&scope=offline&redirect_uri=https://oauth.vk.com/blank.html=mobile&response_type=token';
private function onBtnVKClick(event:Event):void
{
stage_web_view = new StageWebView();
stage_web_view.stage = stage;
stage_web_view.viewPort = new Rectangle(25, 25, APP_WIDTH - 50, APP_HEIGHT -50);
stage_web_view.addEventListener(LocationChangeEvent.LOCATION_CHANGE, onCheckAuthVK);
stage_web_view.loadURL( VK_URL_AUTH );
}
private function onCheckAuthVK(event:Event)
{
var url:String = stage_web_view.location;
//url = 'https://oauth.vk.com/blank.html#access_token=.....&expires_in=0&user_id=...';
if ( url.indexOf('//oauth.vk.com/blank.html#') > 0)
{
var arr:Array = url.split('#'); trace('STR TOKEN', arr[1]);
var url_varitable:URLVariables = new URLVariables(arr[1]);
trace('access_token ', url_varitable['access_token'], url_varitable['user_id']);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question