Documentation

OAuthInterface extends ClientInterface

Specifies the basic methods for an OAuth provider.

Table of Contents

Constants

HEADERS_API  = []
additional headers to use during API access
HEADERS_AUTH  = []
additional headers to use during authentication

Methods

getAccessTokenFromStorage()  : AccessToken
Gets an access token from the current OAuthStorageInterface (shorthand/convenience)
getAuthURL()  : UriInterface
Prepares the URL with optional $params which redirects to the provider's authorization prompt and returns a PSR-7 UriInterface with all necessary parameters set
getStorage()  : OAuthStorageInterface
Returns the current OAuthStorageInterface
me()  : ResponseInterface
Returns information about the currently authenticated user (usually a /me or /user endpoint).
request()  : ResponseInterface
Prepares an API request to $path with the given parameters, gets authorization, fires the request and returns a PSR-7 ResponseInterface with the corresponding API response
setLogger()  : static
Sets an optional PSR-3 LoggerInterface
setRequestFactory()  : static
Sets an optional PSR-17 RequestFactoryInterface
setStorage()  : static
Sets an optional OAuthStorageInterface
setStreamFactory()  : static
Sets an optional PSR-17 StreamFactoryInterface
setUriFactory()  : static
Sets an optional PSR-17 UriFactoryInterface
storeAccessToken()  : static
Sets an access token in the current OAuthStorageInterface (shorthand/convenience)

Constants

HEADERS_API

additional headers to use during API access

public array<string|int, mixed> HEADERS_API = []

Note: must not contain: Authorization

HEADERS_AUTH

additional headers to use during authentication

public array<string|int, mixed> HEADERS_AUTH = []

Note: must not contain: Accept-Encoding, Authorization, Content-Length, Content-Type

Methods

getAccessTokenFromStorage()

Gets an access token from the current OAuthStorageInterface (shorthand/convenience)

public getAccessTokenFromStorage() : AccessToken
Return values
AccessToken

getAuthURL()

Prepares the URL with optional $params which redirects to the provider's authorization prompt and returns a PSR-7 UriInterface with all necessary parameters set

public getAuthURL([array<string|int, mixed>|null $params = null ][, array<string|int, mixed>|null $scopes = null ]) : UriInterface
Parameters
$params : array<string|int, mixed>|null = null
$scopes : array<string|int, mixed>|null = null
Tags
see
https://datatracker.ietf.org/doc/html/rfc5849#section-2.2
see
https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.1
Return values
UriInterface

me()

Returns information about the currently authenticated user (usually a /me or /user endpoint).

public me() : ResponseInterface

Throws a ProviderException if no such information is available or if the method cannot be implemented.

Return values
ResponseInterface

request()

Prepares an API request to $path with the given parameters, gets authorization, fires the request and returns a PSR-7 ResponseInterface with the corresponding API response

public request(string $path[, array<string|int, mixed>|null $params = null ][, string|null $method = null ][, StreamInterface|array<string|int, mixed>|string|null $body = null ][, array<string|int, mixed>|null $headers = null ][, string|null $protocolVersion = null ]) : ResponseInterface
Parameters
$path : string
$params : array<string|int, mixed>|null = null
$method : string|null = null
$body : StreamInterface|array<string|int, mixed>|string|null = null
$headers : array<string|int, mixed>|null = null
$protocolVersion : string|null = null
Return values
ResponseInterface

setLogger()

Sets an optional PSR-3 LoggerInterface

public setLogger(LoggerInterface $logger) : static
Parameters
$logger : LoggerInterface
Return values
static

setRequestFactory()

Sets an optional PSR-17 RequestFactoryInterface

public setRequestFactory(RequestFactoryInterface $requestFactory) : static
Parameters
$requestFactory : RequestFactoryInterface
Return values
static

setStreamFactory()

Sets an optional PSR-17 StreamFactoryInterface

public setStreamFactory(StreamFactoryInterface $streamFactory) : static
Parameters
$streamFactory : StreamFactoryInterface
Return values
static

setUriFactory()

Sets an optional PSR-17 UriFactoryInterface

public setUriFactory(UriFactoryInterface $uriFactory) : static
Parameters
$uriFactory : UriFactoryInterface
Return values
static

storeAccessToken()

Sets an access token in the current OAuthStorageInterface (shorthand/convenience)

public storeAccessToken(AccessToken $token) : static
Parameters
$token : AccessToken
Return values
static

        
On this page

Search results