Could you double check that the access token and access token secret is being passed into the app via flashvars? Note that YAP doesn't provide these variables, but you need to pass them in manually. That error suggests that the AS3 code signed the request successfully given the info it has, but errored out because something was missing/invalid.
Something like this:
CODE
var ck:String = "myConsumerKey";
var cks:String = "myConsumerSecret";
var atk:String = "myAccessToken";
var ats:String = "myAccessTokenSecret";
YahooSession.YAP_VIEWER = "ABCDEFGHIJKLMOPQRSTUVWXYZ";
YahooSession.YAP_APPID = "FOOAPPID";
_session = new YahooSession(ck, cks, atk, ats);
_user = _session.getSessionedUser();
Thank you for the reply, BasicTheory.
In order to check that atk and ats are passed into swf, I had uploaded a slightly different version of swf that prints out the cks, atk, and ats onto Alert.
It is here:
http://apps.yahoo.com/-T54MJg36The FullView page also prints out the access token , access token secret parameters. I compared them a few days ago, and they seems to be the same, assuming that I had done escape/unescape correctly. The page itself is created with Python. If there is anything that I should watch out when doing the escaping on Python, please don't hesitate to speak out, no matter how obvious you might think it is.
You may also take a look at the page and check whether atk and ats are correct:
http://apps.yahoo.com/-T54MJg36Here is the code that I used to print out the data:
CODE
var flashvars:Object = Application.application.parameters;
var ck:String = flashvars.yap_consumer_key; // consumer key
var cks:String = CONSUMER_SECRET; // consumer secret
var atk:String = flashvars.yap_viewer_access_token; // access token
var ats:String = flashvars.yap_viewer_access_token_secret; // access token secret
YahooSession.YAP_OWNER = flashvars.yap_owner_guid;
YahooSession.YAP_VIEWER = flashvars.yap_viewer_guid;
YahooSession.YAP_APPID = flashvars.yap_appid;
Alert.show("handleInitialize(). ck="+ck+"\n cks="+cks+"\n atk="+atk+"\n ats="+ats+"\n yap_owner="+YahooSession.YAP_OWNER+"\n yap_viewer="+YahooSession.YAP_VIEWER+"\n app_id="+YahooSession.YAP_APPID);
Here is the full code:
CODE
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundGradientColors="[#FEFEFE, #E8E8E8]"
initialize="handleInitialize(event);"
layout="absolute"
width="780" backgroundGradientAlphas="[1.0, 1.0]" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
import flash.net.navigateToURL;
import mx.controls.Alert;
import com.yahoo.social.data.Profile;
import com.yahoo.social.events.YahooResultEvent;
import com.yahoo.social.YahooUser;
import com.yahoo.social.YahooSession;
import mx.events.FlexEvent;
private var _session:YahooSession;
[Bindable]
private var _viewerProfile:Profile;
[Bindable]
private var _nickname:String = "";
[Bindable]
private var _location:String = "";
private static const CONSUMER_SECRET:String = "dj0yJmk9ZmVVTjlVRGowYmNiJmQ9WVdrOVZEVTBUVXBuTXpZbWNHbzlNak15TWprek16RTImcz1j
b25zdW1lcnNlY3JldCZ4PWE3";
private function handleInitialize(event:FlexEvent):void
{
var flashvars:Object = Application.application.parameters;
var ck:String = flashvars.yap_consumer_key; // consumer key
var cks:String = CONSUMER_SECRET; // consumer secret
var atk:String = flashvars.yap_viewer_access_token; // access token
var ats:String = flashvars.yap_viewer_access_token_secret; // access token secret
YahooSession.YAP_OWNER = flashvars.yap_owner_guid;
YahooSession.YAP_VIEWER = flashvars.yap_viewer_guid;
YahooSession.YAP_APPID = flashvars.yap_appid;
Alert.show("handleInitialize(). ck="+ck+"\n cks="+cks+"\n atk="+atk+"\n ats="+ats+"\n yap_owner="+YahooSession.YAP_OWNER+"\n yap_viewer="+YahooSession.YAP_VIEWER+"\n app_id="+YahooSession.YAP_APPID);
_session = new YahooSession(ck, cks, atk, ats);
var user:YahooUser = _session.getSessionedUser();
user.profile.addEventListener(YahooResultEvent.GET_PROFILE_SUCCESS, handleUserGetProfile);
user.profile.addEventListener(YahooResultEvent.GET_PROFILE_FAILURE, handleUserGetProfileFail);
user.profile.getProfile();
}
private function handleUserGetProfileFail(event:YahooResultEvent):void
{
Alert.show("Error loading data from "+event.data.url, "Error");
}
private function handleUserGetProfile(event:YahooResultEvent):void
{
Alert.show("handleUserGetProfile()");
_viewerProfile = event.data as Profile;
_nickname = _viewerProfile.nickname;
_location = _viewerProfile.location;
txtNickname.text = _viewerProfile.nickname;
txtLocation.text = _viewerProfile.location;
}
]]>
</mx:Script>
<mx:Image width="192" height="192" source="{_viewerProfile.image.imageUrl}" horizontalCenter="0" top="10"/>
<mx:Text id="txtNickname" text="" fontFamily="Arial" fontSize="14" color="#333333" horizontalCenter="0" top="210"/>
<mx:Text id="txtLocation" text="" fontFamily="Arial" fontSize="14" color="#333333" horizontalCenter="0" top="230" fontStyle="italic"/>
<mx:LinkButton y="260" click="flash.net.navigateToURL(new URLRequest(_viewerProfile.profileUrl),'_blank');" label="View my Profile" horizontalCenter="0" color="#860078"/>
</mx:Application>