Class SpazOAuth

SpazOAuth

Defined in: spazauth.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
SpazOAuth(realm, options)

Construct a new OAuth authentication object.

Method Summary
Method Attributes Method Name and Description
 
authorize(username, password, onComplete)

Authorize access to the service by fetching an OAuth access token.

 
load(pickle)

Load OAuth credentials from a serialized string

 
save()

Save OAuth credentials to a serialized string

 
setAccessToken(key, secret)

Set the access token

 
signRequest(method, url, parameters)

Sign a HTTP request and return oAuth header

Class Detail

SpazOAuth(realm, options)

Construct a new OAuth authentication object.

Parameters:
{string} realm
{object} options
Method Detail

{boolean} authorize(username, password, onComplete)

Authorize access to the service by fetching an OAuth access token.

Parameters:
{string} username
{string} password
{function} onComplete Optional
a callback to fire on complete. If this is set, the request is asynchronous
Returns:
{boolean} true if authorization successful, otherwise false

{boolean} load(pickle)

Load OAuth credentials from a serialized string

Parameters:
{string} pickle
the serialized string returned by save()
Returns:
{boolean} true if successfully loaded

{string} save()

Save OAuth credentials to a serialized string

Returns:
{string} serialized string

setAccessToken(key, secret)

Set the access token

Parameters:
{string} key
{string} secret

{string} signRequest(method, url, parameters)

Sign a HTTP request and return oAuth header

Parameters:
{string} method
HTTP method of the request
{string} url
the URL of the request
{object} parameters
map of all parameters in the request
Returns:
{string} Authorization header value