class JOAuth2Client

Joomla Platform class for interacting with an OAuth 2.0 server.

Methods

__construct( Registry $options = null, JHttp $http = null, JInput $input = null, JApplicationWeb $application = null)

Constructor.

string
authenticate()

Get the access token or redict to the authentication URL.

boolean
isAuthenticated()

Verify if the client has been authenticated

JHttpResponse
createUrl()

Create the URL for authentication.

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

Send a signed Oauth request.

mixed
getOption( string $key)

Get an option from the JOAuth2Client instance.

setOption( string $key, mixed $value)

Set an option for the JOAuth2Client instance.

array
getToken()

Get the access token from the JOAuth2Client instance.

setToken( array $value)

Set an option for the JOAuth2Client instance.

array
refreshToken( string $token = null)

Refresh the access token instance.

Details

__construct( Registry $options = null, JHttp $http = null, JInput $input = null, JApplicationWeb $application = null)

Constructor.

Parameters

Registry $options JOAuth2Client options object
JHttp $http The HTTP client object
JInput $input The input object
JApplicationWeb $application The application object

string authenticate()

Get the access token or redict to the authentication URL.

Return Value

string The access token

Exceptions

RuntimeException

boolean isAuthenticated()

Verify if the client has been authenticated

Return Value

boolean Is authenticated

JHttpResponse createUrl()

Create the URL for authentication.

Return Value

JHttpResponse The HTTP response

Exceptions

InvalidArgumentException

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

Send a signed Oauth request.

Parameters

string $url The URL for the request.
mixed $data The data to include in the request
array $headers The headers to send with the request
string $method The method with which to send the request
int $timeout The timeout for the request

Return Value

string The URL.

Exceptions

InvalidArgumentException
RuntimeException

mixed getOption( string $key)

Get an option from the JOAuth2Client instance.

Parameters

string $key The name of the option to get

Return Value

mixed The option value

JOAuth2Client setOption( string $key, mixed $value)

Set an option for the JOAuth2Client instance.

Parameters

string $key The name of the option to set
mixed $value The option value to set

Return Value

JOAuth2Client This object for method chaining

array getToken()

Get the access token from the JOAuth2Client instance.

Return Value

array The access token

JOAuth2Client setToken( array $value)

Set an option for the JOAuth2Client instance.

Parameters

array $value The access token

Return Value

JOAuth2Client This object for method chaining

array refreshToken( string $token = null)

Refresh the access token instance.

Parameters

string $token The refresh token

Return Value

array The new access token

Exceptions

Exception
RuntimeException