Packagecom.yahoo.social.utils
Classpublic class YahooSessionStore
ImplementsIYahooSessionStore

An implementation of IYahooSessionStore that uses a SharedObject to keep OAuth request and access tokens cached on the users machine for later use.


Example
   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
   }
  



Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined by
  
Class constructor Creates
YahooSessionStore
  
clearAccessToken():Boolean
Removes the access token from the SharedObject.
YahooSessionStore
  
Removes the request token from the SharedObject.
YahooSessionStore
  
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
Protected Methods
 MethodDefined 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
Property detail
shareDataproperty
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.

Implementation
    public function get shareData():Boolean
    public function set shareData(value:Boolean):void

See also

sharedObjectPath
flash.net.SharedObject
sharedObjectPathproperty 
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
Constructor detail
YahooSessionStore()constructor
public function YahooSessionStore()

Class constructor Creates

Method detail
clearAccessToken()method
public function clearAccessToken():Boolean

Removes the access token from the SharedObject.

Returns
Boolean
clearRequestToken()method 
public function clearRequestToken():Boolean

Removes the request token from the SharedObject.

Returns
Boolean
clearSessionToken()method 
public function 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.

decodeToken()method 
protected function decodeToken(str:String):Object

Decodes a Base64 encoded string returning a native object containing the OAuth token variables.

Parameters
str:String

Returns
Object
encodeToken()method 
protected function encodeToken(token:OAuthToken):String

Creates a Base64 encoded string representing the token provided.

Parameters
token:OAuthToken

Returns
String
flush()method 
protected function flush():Boolean

Flushes the shared object.

Returns
Boolean — Returns true if the flush was successfully completed.
getAccessToken()method 
public function getAccessToken():OAuthToken

Reads the access token data and returns an OAuthToken object.

Returns
OAuthToken
getRequestToken()method 
public function getRequestToken():OAuthToken

Reads the request token data and returns an OAuthToken object.

Returns
OAuthToken
setAccessToken()method 
public function setAccessToken(token:OAuthToken):Boolean

Sets the accessToken value of the SharedObject data and flushes the data.

Parameters
token:OAuthToken

Returns
Boolean
setRequestToken()method 
public function setRequestToken(token:OAuthToken):Boolean

Parameters
token:OAuthToken

Returns
Boolean