| Package | com.yahoo.social.utils |
| Class | public class YahooSessionStore |
| Implements | IYahooSessionStore |
YahooSession.YAP_APPID = "your-appid";
var _session:YahooSession = new YahooSession(CONSUMER_KEY, CONSUMER_SECRET);
var _accessToken:OAuthToken = _session.sessionStore.getAccessToken();
if( _accessToken ) {
// try to set the token
var hasSession:Boolean = _session.setAccessToken(_accessToken);
if(hasSession == false) {
_session.auth.addEventListener(YahooResultEvent.GET_ACCESS_TOKEN_SUCCESS, handleGetAccessToken);
_session.auth.getAccessToken(_accessToken);
} else {
doStuff();
}
} else {
// start request token and user authorization flow.
}
function handleGetAccessToken(event:YahooResultEvent):void
{
_accessToken = event.data as OAuthToken;
_session.setAccessToken(_accessToken);
_session.sessionStore.setAccessToken(_accessToken);
doStuff();
}
function doStuff():void
{
// load profile, connections or updates
}
| Property | Defined by | ||
|---|---|---|---|
| shareData : Boolean
Determines Whether to share the auto-complete data with other applications
or keep it private to this application.
| YahooSessionStore | ||
| sharedObjectPath : String
The name of the SharedObject in which to store session token entries.
| YahooSessionStore | ||
| Method | Defined by | ||
|---|---|---|---|
|
Class constructor
Creates
| YahooSessionStore | ||
|
clearAccessToken():Boolean
Removes the access token from the SharedObject.
| YahooSessionStore | ||
|
clearRequestToken():Boolean
Removes the request token from the SharedObject.
| YahooSessionStore | ||
|
clearSessionToken():void
Removes the request and access tokens from the shared object by
purging all of the data and deleting the shared object from the disk.
| YahooSessionStore | ||
|
Reads the access token data and returns an OAuthToken object.
| YahooSessionStore | ||
|
Reads the request token data and returns an OAuthToken object.
| YahooSessionStore | ||
|
setAccessToken(token:OAuthToken):Boolean
Sets the accessToken value of the SharedObject data and flushes the data.
| YahooSessionStore | ||
|
setRequestToken(token:OAuthToken):Boolean
| YahooSessionStore | ||
| Method | Defined by | ||
|---|---|---|---|
|
decodeToken(str:String):Object
Decodes a Base64 encoded string returning a native object containing
the OAuth token variables.
| YahooSessionStore | ||
|
encodeToken(token:OAuthToken):String
Creates a Base64 encoded string representing the token provided.
| YahooSessionStore | ||
|
flush():Boolean
Flushes the shared object.
| YahooSessionStore | ||
| shareData | property |
shareData:Boolean [read-write]Determines Whether to share the auto-complete data with other applications or keep it private to this application.
Please note that setting this to true will all applications in the domain
to access any information in the Shared Object. For instance, if a third party
application hosted on the same domain knows the name of the Shared Object
(which is by default "YahooSessionData"), they may be able to read and write to it.
If you choose to set this to true, you should consider setting the
sharedObjectPath to a value only your applications are aware of,
especially a password-like value or some value returned from a server.
In this way, you make it difficult or impossible for a third party
to access this information.
The default value is false.
public function get shareData():Boolean
public function set shareData(value:Boolean):void
See also
| sharedObjectPath | property |
sharedObjectPath:String [read-write]The name of the SharedObject in which to store session token entries.
Implementation public function get sharedObjectPath():String
public function set sharedObjectPath(value:String):void
| YahooSessionStore | () | constructor |
public function YahooSessionStore()Class constructor Creates
| clearAccessToken | () | method |
public function clearAccessToken():BooleanRemoves the access token from the SharedObject.
ReturnsBoolean |
| clearRequestToken | () | method |
public function clearRequestToken():BooleanRemoves the request token from the SharedObject.
ReturnsBoolean |
| clearSessionToken | () | method |
public function clearSessionToken():voidRemoves the request and access tokens from the shared object by purging all of the data and deleting the shared object from the disk.
| decodeToken | () | method |
protected function decodeToken(str:String):ObjectDecodes a Base64 encoded string returning a native object containing the OAuth token variables.
Parametersstr:String |
Object |
| encodeToken | () | method |
protected function encodeToken(token:OAuthToken):StringCreates a Base64 encoded string representing the token provided.
Parameterstoken:OAuthToken |
String |
| flush | () | method |
protected function flush():BooleanFlushes the shared object.
ReturnsBoolean — Returns true if the flush was successfully completed.
|
| getAccessToken | () | method |
public function getAccessToken():OAuthTokenReads the access token data and returns an OAuthToken object.
ReturnsOAuthToken |
| getRequestToken | () | method |
public function getRequestToken():OAuthTokenReads the request token data and returns an OAuthToken object.
ReturnsOAuthToken |
| setAccessToken | () | method |
public function setAccessToken(token:OAuthToken):BooleanSets the accessToken value of the SharedObject data and flushes the data.
Parameterstoken:OAuthToken |
Boolean |
| setRequestToken | () | method |
public function setRequestToken(token:OAuthToken):BooleanParameters
token:OAuthToken |
Boolean |