Client

Joomla Framework class for interacting with an OAuth 1.0 and 1.0a server.

abstract
since

1.0

package

Joomla Framework

Methods

__construct

Constructor.

__construct(\Joomla\Application\SessionAwareWebApplicationInterface application, \Joomla\Http\Http client = null, \Joomla\Input\Input input = null, array|\ArrayAccess options = [],  version = '1.0a') : 
since

1.0

Arguments

application

SessionAwareWebApplicationInterfaceThe application object

client

Http|nullThe HTTP client object.

input

Input|nullThe input object

options

array<string|int, mixed>|ArrayAccessOAuth1 Client options.

version

stringSpecify the OAuth version. By default we are using 1.0a.

Response

mixed

authenticate

Method to form the oauth flow.

authenticate() : mixed||string|int
since

1.0

throws

DomainException

Response

array<string|int, mixed>The access token.

authorise

Method used to authorise the application.

authorise() : 
since

1.1.2

Response

void

baseString

Prepare the signature base string.

baseString( url,  method, mixed||string|int parameters) : 
since

1.1.2

Arguments

url

stringThe URL to sign.

method

stringThe request method.

parameters

array<string|int, mixed>Array containing request parameters.

Response

stringThe base string.

createHeader

Method used to create the header for the POST request.

createHeader(mixed||string|int parameters) : 
since

1.1.2

Arguments

parameters

array<string|int, mixed>Array containing request parameters.

Response

stringThe header.

generateAccessToken

Method used to get an access token.

generateAccessToken() : 
since

1.1.2

Response

void

generateNonce

Method used to generate the current nonce.

generateNonce() : 
static
since

1.0

Response

stringThe current nonce.

generateRequestToken

Method used to get a request token.

generateRequestToken() : 
since

1.1.2

throws

DomainException

Response

void

getOption

Get an option from the OAuth1 Client instance.

getOption( key,  default = null) : 
since

1.0

Arguments

key

stringThe name of the option to get

default

mixedOptional default value if the option does not exist

Response

mixedThe option value

getToken

Get the oauth token key or secret.

getToken() : mixed||string|int
since

1.0

Response

array<string|int, mixed>The oauth token key and secret.

oauthRequest

Method used to make an OAuth request.

oauthRequest( url,  method, mixed||string|int parameters,  data = [], mixed||string|int headers = []) : \Joomla\Http\Response
since

1.0

throws

DomainException

Arguments

url

stringThe request URL.

method

stringThe request method.

parameters

array<string|int, mixed>Array containing request parameters.

data

mixedThe POST request data.

headers

array<string|int, mixed>An array of name-value pairs to include in the header of the request

Response

Response

prepareSigningKey

Prepares the OAuth signing key.

prepareSigningKey() : 
since

1.1.2

Response

stringThe prepared signing key.

safeEncode

Encodes the string or array passed in a way compatible with OAuth.

safeEncode(string|string[] data) : string|string[]

If an array is passed each array value will will be encoded.

since

1.0

Arguments

data

string|array<string|int, string>The scalar or array to encode.

Response

string|array<string|int, string>$data encoded in a way compatible with OAuth.

setOption

Set an option for the OAuth1 Client instance.

setOption( key,  value) : 
since

1.0

Arguments

key

stringThe name of the option to set

value

mixedThe option value to set

Response

$this

setToken

Set the oauth token.

setToken(mixed||string|int token) : 
since

1.0

Arguments

token

array<string|int, mixed>The access token key and secret.

Response

$this

signRequest

Method used to sign requests.

signRequest( url,  method, mixed||string|int parameters) : mixed||string|int
since

1.1.2

Arguments

url

stringThe URL to sign.

method

stringThe request method.

parameters

array<string|int, mixed>Array containing request parameters.

Response

array<string|int, mixed>The array containing the request parameters, including signature.

toUrl

Method to create the URL formed string with the parameters.

toUrl( url, mixed||string|int parameters) : 
since

1.0

Arguments

url

stringThe request URL.

parameters

array<string|int, mixed>Array containing request parameters.

Response

stringThe formed URL.

validateResponse

Method to validate a response.

validateResponse( url, \Joomla\Http\Response response) : 
abstract
since

1.0

throws

DomainException

Arguments

url

stringThe request URL.

response

ResponseThe response to validate.

Response

void

verifyCredentials

Returns an HTTP 200 OK response code and a representation of the requesting user if authentication was successful; returns a 401 status code and an error message if not.

verifyCredentials() : mixed||string|int
abstract
since

1.0

Response

array<string|int, mixed>The decoded JSON response

Properties

options

Options for the Client object.

since

1.0

Type(s)

array<string|int, mixed>|ArrayAccess

token

Contains access token key, secret and verifier.

since

1.0

Type(s)

array<string|int, mixed>

client

The HTTP client object to use in sending HTTP requests.

since

1.0

Type(s)

Http

input

The input object to use in retrieving GET/POST data.

since

1.0

Type(s)

Input

application

The application object to send HTTP headers for redirects.

version

Selects which version of OAuth to use: 1.0 or 1.0a.

since

1.0

Type(s)

string