Client

Joomla Framework class for interacting with an OAuth 2.0 server.

since

1.0

package

Joomla Framework

Methods

__construct

Constructor.

__construct(array|\ArrayAccess options = [], \Joomla\Http\Http http = null, \Joomla\Input\Input input = null, \Joomla\Application\WebApplicationInterface application = null) : mixed
since

1.0

Arguments

options

array|\ArrayAccessOAuth2 Client options object

http

\Joomla\Http\HttpThe HTTP client object

input

\Joomla\Input\InputThe input object

application

\Joomla\Application\WebApplicationInterfaceThe application object

Response

mixed

authenticate

Get the access token or redirect to the authentication URL.

authenticate() : array|bool
since

1.0

throws

\Joomla\Http\Exception\UnexpectedResponseException

\RuntimeException

Response

array|boolThe access token or false on failure

createUrl

Create the URL for authentication.

createUrl() : string
since

1.0

throws

\InvalidArgumentException

Response

string

getOption

Get an option from the OAuth2 Client instance.

getOption(string key, mixed default = null) : mixed
since

1.0

Arguments

key

stringThe name of the option to get

default

mixedOptional default value, returned if the requested option does not exist.

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() : bool
since

1.0

Response

boolIs authenticated

query

Send a signed OAuth request.

query(string url, mixed data = null, array headers = [], string method = 'get', int timeout = null) : \Joomla\Http\Response
since

1.0

throws

\InvalidArgumentException

\RuntimeException

Arguments

url

stringThe URL for the request

data

mixedEither an associative array or a string to be sent with the request

headers

arrayThe headers to send with the request

method

stringThe method with which to send the request

timeout

intThe timeout for the request

Response

\Joomla\Http\Response

refreshToken

Refresh the access token instance.

refreshToken(string token = null) : array
since

1.0

throws

\Joomla\Http\Exception\UnexpectedResponseException

\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|\ArrayAccess

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.

since

1.0

Type(s)

\Joomla\Application\WebApplicationInterface