Client
Joomla Framework class for interacting with an OAuth 1.0 and 1.0a server.
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 = [], string version = '1.0a') : mixed
since |
1.0 |
---|
Arguments
- application
\Joomla\Application\SessionAwareWebApplicationInterface
The application object- client
\Joomla\Http\Http
The HTTP client object.- input
\Joomla\Input\Input
The input object- options
array|\ArrayAccess
OAuth1 Client options.- version
string
Specify the OAuth version. By default we are using 1.0a.
Response
mixed
authenticate
Method to form the oauth flow.
authenticate() : array|null
since |
1.0 |
---|---|
throws |
|
Response
array|null
The access token.
authorise
Method used to authorise the application.
authorise() : void
since |
1.1.2 |
---|
baseString
Prepare the signature base string.
baseString(string url, string method, array parameters) : string
since |
1.1.2 |
---|
Arguments
- url
string
The URL to sign.- method
string
The request method.- parameters
array
Array containing request parameters.
Response
string
The base string.
createHeader
Method used to create the header for the POST request.
createHeader(array parameters) : string
since |
1.1.2 |
---|
Arguments
- parameters
array
Array containing request parameters.
Response
string
The header.
generateAccessToken
Method used to get an access token.
generateAccessToken() : void
since |
1.1.2 |
---|
generateNonce
Method used to generate the current nonce.
generateNonce() : string
since |
1.0 |
---|
Response
string
The current nonce.
generateRequestToken
Method used to get a request token.
generateRequestToken() : void
since |
1.1.2 |
---|---|
throws |
|
getOption
Get an option from the OAuth1 Client instance.
getOption(string key, mixed default = null) : mixed
since |
1.0 |
---|
Arguments
- key
string
The name of the option to get- default
mixed
Optional default value if the option does not exist
Response
mixed
The option value
getToken
Get the oauth token key or secret.
getToken() : array
since |
1.0 |
---|
Response
array
The oauth token key and secret.
oauthRequest
Method used to make an OAuth request.
oauthRequest(string url, string method, array parameters, mixed data = [], array headers = []) : \Joomla\Http\Response
since |
1.0 |
---|---|
throws |
|
Arguments
- url
string
The request URL.- method
string
The request method.- parameters
array
Array containing request parameters.- data
mixed
The POST request data.- headers
array
An array of name-value pairs to include in the header of the request
Response
\Joomla\Http\Response
prepareSigningKey
Prepares the OAuth signing key.
prepareSigningKey() : string
since |
1.1.2 |
---|
Response
string
The prepared signing key.
safeEncode
Encodes the string or array passed in a way compatible with OAuth.
safeEncode(mixed data) : string
If an array is passed each array value will will be encoded.
since |
1.0 |
---|
Arguments
- data
mixed
The scalar or array to encode.
Response
string
$data encoded in a way compatible with OAuth.
setOption
Set an option for the OAuth1 Client instance.
setOption(string key, mixed value) : $this
since |
1.0 |
---|
Arguments
- key
string
The name of the option to set- value
mixed
The option value to set
Response
$this
setToken
Set the oauth token.
setToken(array token) : $this
since |
1.0 |
---|
Arguments
- token
array
The access token key and secret.
Response
$this
signRequest
Method used to sign requests.
signRequest(string url, string method, array parameters) : array
since |
1.1.2 |
---|
Arguments
- url
string
The URL to sign.- method
string
The request method.- parameters
array
Array containing request parameters.
Response
array
The array containing the request parameters, including signature.
toUrl
Method to create the URL formed string with the parameters.
toUrl(string url, array parameters) : string
since |
1.0 |
---|
Arguments
- url
string
The request URL.- parameters
array
Array containing request parameters.
Response
string
The formed URL.
validateResponse
Method to validate a response.
validateResponse(string url, \Joomla\OAuth1\Response response) : void
since |
1.0 |
---|---|
throws |
|
Arguments
- url
string
The request URL.- response
\Joomla\OAuth1\Response
The response to validate.
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() : array
since |
1.0 |
---|
Response
array
The decoded JSON response
Properties
options
Options for the Client object.
since |
1.0 |
---|
Type(s)
array|\ArrayAccess
token
Contains access token key, secret and verifier.
since |
1.0 |
---|
Type(s)
array
client
The HTTP client object to use in sending HTTP requests.
since |
1.0 |
---|
Type(s)
\Joomla\Http\Http
input
The input object to use in retrieving GET/POST data.
since |
1.0 |
---|
Type(s)
\Joomla\Input\Input
application
The application object to send HTTP headers for redirects.
since |
1.0 |
---|
Type(s)
\Joomla\Application\SessionAwareWebApplicationInterface
version
Selects which version of OAuth to use: 1.0 or 1.0a.
since |
1.0 |
---|
Type(s)
string