Packagecom.yahoo.social
Classpublic class YahooSession
InheritanceYahooSession Inheritance flash.events.EventDispatcher

The YahooSession object defines a session between an application and the Yahoo! Platform. It is the gateway to accessing user information with the Yahoo! Social APIs.


Example
   // create a yahoo session object and pass 
   //into it the oauth credentials, appid and a guid
   var session:YahooSession = new YahooSession('consumerKey', 'consumerSecret', 'appid');
  

See also

AuthenticationRequest


Public Properties
 PropertyDefined by
  application : ApplicationRequest
[read-only] The instance of the ApplicationRequest API for this session.
YahooSession
  auth : AuthorizationRequest
[read-only] The instance of the AuthorizationRequest request object for the consumer of this session.
YahooSession
  ownerGuid : String
The guid of the owning user.
YahooSession
  sessionStore : IYahooSessionStore
The implementation of IYahooSessionStore attached to this session.
YahooSession
  viewerGuid : String
The guid of the viewing user.
YahooSession
  yql : YQL
[read-only] The instance of the YQL API for this session.
YahooSession
Public Methods
 MethodDefined by
  
YahooSession(consumerKey:String, consumerSecret:String, applicationId:String, sessionStore:IYahooSessionStore = null)
Creates a new YahooSession object.
YahooSession
  
clearSession():void
Clears the session access token and removes all tokens from the session store.
YahooSession
  
The OAuthToken object for this session.
YahooSession
  
The OAuthConsumer object for this application.
YahooSession
  
Returns a YahooUser object representing the profile owner defined by YahooSession.YAP_OWNER or the OAuth access token.
YahooSession
  
Returns a YahooUser object representing the currently sessioned user (the viewer of the application) defined by YahooSession.YAP_VIEWER or the OAuth access token.
YahooSession
  
getUser(guid:String):YahooUser
Gets the user indicated by the GUID given.
YahooSession
  
openMessageDialog(to_guids:Array = null, subject:String = null, body:String = null, image:String = null):void
Directs the container to open the yml:message dialog.
YahooSession
  
openShareDialog(to_guids:Array = null, subject:String = null, body:String = null, image:String = null):void
Directs the container to open the yml:share dialog.
YahooSession
  
saveSession():void
Saves the session's request and access token to the token store.
YahooSession
  
sessionFromYAP(consumerKey:String, consumerSecret:String, applicationId:String, accessTokenKey:String, accessTokenSecret:String, viewerGUID:String):YahooSession
[static]
YahooSession
  
setAccessToken(token:OAuthToken):Boolean
Sets the session access token object.
YahooSession
Property detail
applicationproperty
application:ApplicationRequest  [read-only]

The instance of the ApplicationRequest API for this session.

Implementation
    public function get application():ApplicationRequest
authproperty 
auth:AuthorizationRequest  [read-only]

The instance of the AuthorizationRequest request object for the consumer of this session.

Implementation
    public function get auth():AuthorizationRequest
ownerGuidproperty 
public var ownerGuid:String

The guid of the owning user.

sessionStoreproperty 
sessionStore:IYahooSessionStore  [read-write]

The implementation of IYahooSessionStore attached to this session.

The default value is YahooSessionStore.

Implementation
    public function get sessionStore():IYahooSessionStore
    public function set sessionStore(value:IYahooSessionStore):void

See also

YahooSessionStore
IYahooSessionStore
viewerGuidproperty 
public var viewerGuid:String

The guid of the viewing user.

yqlproperty 
yql:YQL  [read-only]

The instance of the YQL API for this session.

Implementation
    public function get yql():YQL
Constructor detail
YahooSession()constructor
public function YahooSession(consumerKey:String, consumerSecret:String, applicationId:String, sessionStore:IYahooSessionStore = null)

Creates a new YahooSession object.

Parameters
consumerKey:String — A String containing the OAuth consumer key. (API Key)
 
consumerSecret:String — A String containing the OAuth consumer secret.
 
applicationId:String — A String containing the application ID to identify this session.
 
sessionStore:IYahooSessionStore (default = null) — An optional implementation of IYahooSessionStore used to cache OAuth tokens. Note: An access token key/secret must be obtained by a server-side component or via the auth property of YahooSession.
Method detail
clearSession()method
public function clearSession():void

Clears the session access token and removes all tokens from the session store.

getAccessToken()method 
public function getAccessToken():OAuthToken

The OAuthToken object for this session.

Returns
OAuthToken

See also

OAuthToken
getConsumer()method 
public function getConsumer():OAuthConsumer

The OAuthConsumer object for this application.

Returns
OAuthConsumer

See also

OAuthConsumer
getOwner()method 
public function getOwner():YahooUser

Returns a YahooUser object representing the profile owner defined by YahooSession.YAP_OWNER or the OAuth access token. Only valid when a owner GUID is supplied by YAP, otherwise will default to the logged-in user.

Returns
YahooUser

See also

getSessionedUser()method 
public function getSessionedUser():YahooUser

Returns a YahooUser object representing the currently sessioned user (the viewer of the application) defined by YahooSession.YAP_VIEWER or the OAuth access token.

Returns
YahooUser

See also

getUser()method 
public function getUser(guid:String):YahooUser

Gets the user indicated by the GUID given.

Parameters
guid:String — The GUID of the user to get.

Returns
YahooUser — YahooUser The user indicated by the GUID given.

See also

openMessageDialog()method 
public function openMessageDialog(to_guids:Array = null, subject:String = null, body:String = null, image:String = null):void

Directs the container to open the yml:message dialog. Only valid in applications within YAP.

Parameters
to_guids:Array (default = null) — An array of GUIDs in which this message should be addressed to.
 
subject:String (default = null) — The message subject.
 
body:String (default = null) — The message body.
 
image:String (default = null) — A URL to an image to show in the dialog.
openShareDialog()method 
public function openShareDialog(to_guids:Array = null, subject:String = null, body:String = null, image:String = null):void

Directs the container to open the yml:share dialog. Only valid in applications within YAP.

Parameters
to_guids:Array (default = null) — An array of GUIDs in which this message should be addressed to.
 
subject:String (default = null) — The message subject.
 
body:String (default = null) — The message body.
 
image:String (default = null) — A URL to an image to show in the dialog.
saveSession()method 
public function saveSession():void

Saves the session's request and access token to the token store.

sessionFromYAP()method 
public static function sessionFromYAP(consumerKey:String, consumerSecret:String, applicationId:String, accessTokenKey:String, accessTokenSecret:String, viewerGUID:String):YahooSession

Parameters
consumerKey:String
 
consumerSecret:String
 
applicationId:String
 
accessTokenKey:String
 
accessTokenSecret:String
 
viewerGUID:String

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

Sets the session access token object. If the token contains a GUID, this function will over-ride the YahooSession.YAP_VIEWER value with the guid defined by the token.

The function will also check if the token expiration time has approached. If it is expired it will return false. At this point you should request a new access token.

If the consumer key does not match the consumer key found in the access token it will return false and not set the session.

Parameters
token:OAuthToken — An OAuthToken object containing the access token and secret.

Returns
Boolean — A Boolean True if the token is valid.