Client

Joomla Framework class for interacting with an OAuth 2.0 server.

since

1.0

Methods

__construct

Constructor.

__construct(array $options = array(), \Joomla\Http\Http $http, \Joomla\Input\Input $input, \Joomla\Application\AbstractWebApplication $application = null) 
since

1.0

Arguments

$options

arrayOAuth2 Client options object

$http

\Joomla\Http\HttpThe HTTP client object

$input

\Joomla\Input\InputThe input object

$application

\Joomla\Application\AbstractWebApplicationThe application object

authenticate

Get the access token or redirect to the authentication URL.

authenticate() : string
since

1.0

throws

\RuntimeException

Response

stringThe access token

createUrl

Create the URL for authentication.

createUrl() : \Joomla\Http\Response
since

1.0

throws

\InvalidArgumentException

Response

\Joomla\Http\ResponseThe HTTP response

getOption

Get an option from the OAuth2 Client instance.

getOption(string $key) : mixed
since

1.0

Arguments

$key

stringThe name of the option to get

Response

mixedThe option value

getToken

Get the access token from the Client instance.

getToken() : array
since

1.0

Response

arrayThe access token

isAuthenticated

Verify if the client has been authenticated

isAuthenticated() : boolean
since

1.0

Response

booleanIs authenticated

query

Send a signed Oauth request.

query(string $url, mixed $data = null, array $headers = array(), string $method = 'get', integer $timeout = null) : string
since

1.0

throws

\InvalidArgumentException

\RuntimeException

Arguments

$url

stringThe URL forf the request.

$data

mixedThe data to include in the request

$headers

arrayThe headers to send with the request

$method

stringThe method with which to send the request

$timeout

integerThe timeout for the request

Response

stringThe URL.

refreshToken

Refresh the access token instance.

refreshToken(string $token = null) : array
since

1.0

throws

\Exception

\RuntimeException

Arguments

$token

stringThe refresh token

Response

arrayThe new access token

setOption

Set an option for the OAuth2 Client instance.

setOption(string $key, mixed $value) : \Joomla\OAuth2\Client
since

1.0

Arguments

$key

stringThe name of the option to set

$value

mixedThe option value to set

Response

\Joomla\OAuth2\ClientThis object for method chaining

setToken

Set an option for the Client instance.

setToken(array $value) : \Joomla\OAuth2\Client
since

1.0

Arguments

$value

arrayThe access token

Response

\Joomla\OAuth2\ClientThis object for method chaining

Properties

options

Options for the Client object.

since

1.0

Type(s)

array

http

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.