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

1.0

Arguments

options

array<string|int, mixed>|ArrayAccessOAuth2 Client options object

http

Http|nullThe HTTP client object

input

Input|nullThe input object

application

WebApplicationInterface|nullThe application object

Response

mixed

authenticate

Get the access token or redirect to the authentication URL.

authenticate() : array|bool
since

1.0

throws

UnexpectedResponseException

RuntimeException

Response

array<string|int, mixed>|boolThe access token or false on failure

createUrl

Create the URL for authentication.

createUrl() : 
since

1.0

throws

InvalidArgumentException

Response

string

getOption

Get an option from the OAuth2 Client instance.

getOption( key,  default = null) : 
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() : mixed||string|int
since

1.0

Response

array<string|int, mixed>The access token

isAuthenticated

Verify if the client has been authenticated

isAuthenticated() : 
since

1.0

Response

boolIs authenticated

query

Send a signed OAuth request.

query( url,  data = null, mixed||string|int headers = [],  method = 'get',  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

array<string|int, mixed>The headers to send with the request

method

stringThe method with which to send the request

timeout

intThe timeout for the request

Response

Response

refreshToken

Refresh the access token instance.

refreshToken( token = null) : mixed||string|int
since

1.0

throws

UnexpectedResponseException

RuntimeException

Arguments

token

stringThe refresh token

Response

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

setOption

Set an option for the OAuth2 Client instance.

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

1.0

Arguments

key

stringThe name of the option to set

value

mixedThe option value to set

Response

ClientThis object for method chaining

setToken

Set an option for the Client instance.

setToken(mixed||string|int value) : \Joomla\OAuth2\Client
since

1.0

Arguments

value

array<string|int, mixed>The access token

Response

ClientThis object for method chaining

Properties

options

Options for the Client object.

since

1.0

Type(s)

array<string|int, mixed>|ArrayAccess

http

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.

since

1.0

Type(s)

WebApplicationInterface