Documentation

Tumblr extends OAuth1Provider
in package

Tumblr OAuth1

Tags
see
https://www.tumblr.com/docs/en/api/v2#oauth1-authorization

Table of Contents

Constants

MAGIC_PROPERTIES  = ['apiDocs', 'apiURL', 'applicationURL', 'serviceName', 'userRevokeURL']

Properties

$accessTokenURL  : string
$apiDocs  : string|null
$apiURL  : string
$applicationURL  : string|null
$authURL  : string
$http  : ClientInterface
$logger  : LoggerInterface
$options  : OAuthOptions|SettingsContainerInterface
$requestFactory  : RequestFactoryInterface
$requestTokenURL  : string
The request OAuth1 token URL
$revokeURL  : string
an optional URL for application side token revocation
$serviceName  : string
the name of the provider/class (magic)
$storage  : OAuthStorageInterface
$streamFactory  : StreamFactoryInterface
$uriFactory  : UriFactoryInterface
$userRevokeURL  : string|null

Methods

__construct()  : mixed
OAuthProvider constructor.
__get()  : string|null
Magic getter for the properties specified in self::ALLOWED_PROPERTIES
exchangeForOAuth2Token()  : AccessToken
Exchange the current token for an OAuth2 token - this will invalidate the OAuth1 token.
getAccessToken()  : AccessToken
Obtains an OAuth1 access token with the given $token and $verifier and returns an AccessToken object.
getAccessTokenFromStorage()  : AccessToken
Gets an access token from the current OAuthStorageInterface (shorthand/convenience)
getAuthURL()  : UriInterface
getRequestAuthorization()  : RequestInterface
getStorage()  : OAuthStorageInterface
Returns the current OAuthStorageInterface
InvalidateAccessToken()  : bool
me()  : ResponseInterface
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
sendRequest()  : ResponseInterface
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)
cleanBodyParams()  : array<string|int, mixed>
Cleans an array of body parameters
cleanQueryParams()  : array<string|int, mixed>
Cleans an array of query parameters
construct()  : void
A replacement constructor that you can call in extended classes, so that you don't have to implement the monstrous original `__construct()`
createAccessToken()  : AccessToken
Creates an access token with the provider set to $this->serviceName
getRequestBody()  : StreamInterface
Prepares the request body
getRequestHeaders()  : array<string|int, mixed>
Prepare request headers
getRequestTarget()  : string
Determine the request target from the given URI (path segment or URL) with respect to $apiURL, anything except host and path will be ignored, scheme will always be set to "https".
getRequestTokenRequestParams()  : array<string|int, mixed>
prepares the parameters for the request token request header
getRequestURL()  : string
Prepares the request URL
getSignature()  : string
Generates a request signature
nonce()  : string
returns a 32 byte random string (in hexadecimal representation) for use as a nonce
parseTokenResponse()  : AccessToken
Parses the response from a request to the token endpoint
sendAccessTokenRequest()  : ResponseInterface
Sends the access token request
sendRequestTokenRequest()  : ResponseInterface
Sends a request to the request token endpoint

Constants

MAGIC_PROPERTIES

protected array<string|int, string> MAGIC_PROPERTIES = ['apiDocs', 'apiURL', 'applicationURL', 'serviceName', 'userRevokeURL']

Properties

$accessTokenURL

protected string $accessTokenURL = 'https://www.tumblr.com/oauth/access_token'

$apiDocs

protected string|null $apiDocs = 'https://www.tumblr.com/docs/en/api/v2'

$apiURL

protected string $apiURL = 'https://api.tumblr.com'

$applicationURL

protected string|null $applicationURL = 'https://www.tumblr.com/oauth/apps'

$authURL

protected string $authURL = 'https://www.tumblr.com/oauth/authorize'

$logger

protected LoggerInterface $logger = new NullLogger()

$requestFactory

protected RequestFactoryInterface $requestFactory

$requestTokenURL

The request OAuth1 token URL

protected string $requestTokenURL = 'https://www.tumblr.com/oauth/request_token'

$serviceName

the name of the provider/class (magic)

protected string $serviceName

$streamFactory

protected StreamFactoryInterface $streamFactory

$userRevokeURL

protected string|null $userRevokeURL = 'https://www.tumblr.com/settings/apps'

Methods

__construct()

OAuthProvider constructor.

public __construct(OAuthOptions|SettingsContainerInterface $options, ClientInterface $http, RequestFactoryInterface $requestFactory, StreamFactoryInterface $streamFactory, UriFactoryInterface $uriFactory[, OAuthStorageInterface $storage = new MemoryStorage() ][, LoggerInterface $logger = new NullLogger() ]) : mixed
Parameters
$options : OAuthOptions|SettingsContainerInterface
$http : ClientInterface
$requestFactory : RequestFactoryInterface
$streamFactory : StreamFactoryInterface
$uriFactory : UriFactoryInterface
$storage : OAuthStorageInterface = new MemoryStorage()
$logger : LoggerInterface = new NullLogger()

__get()

Magic getter for the properties specified in self::ALLOWED_PROPERTIES

public final __get(string $name) : string|null
Parameters
$name : string
Return values
string|null

getAccessToken()

Obtains an OAuth1 access token with the given $token and $verifier and returns an AccessToken object.

public getAccessToken(string $requestToken, string $verifier) : AccessToken
Parameters
$requestToken : string
$verifier : string
Tags
inheritDoc
throws
ProviderException
Return values
AccessToken

getAccessTokenFromStorage()

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

public getAccessTokenFromStorage() : AccessToken
Tags
inheritDoc
codeCoverageIgnore
Return values
AccessToken

getAuthURL()

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
inheritDoc
Return values
UriInterface

getRequestAuthorization()

public getRequestAuthorization(RequestInterface $request[, AccessToken|null $token = null ]) : RequestInterface
Parameters
$request : RequestInterface
$token : AccessToken|null = null
Tags
inheritDoc
Return values
RequestInterface

InvalidateAccessToken()

public InvalidateAccessToken([AccessToken|null $token = null ]) : bool
Parameters
$token : AccessToken|null = null
Tags
implements

\chillerlan\OAuth\Core\TokenInvalidate

codeCoverageIgnore
throws
ProviderException
Return values
bool

me()

public me() : ResponseInterface
Tags
inheritDoc
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
Tags
inheritDoc
throws
UnauthorizedAccessException
Return values
ResponseInterface

sendRequest()

public final sendRequest(RequestInterface $request) : ResponseInterface
Parameters
$request : RequestInterface
Tags
inheritDoc
throws
InvalidAccessTokenException
Return values
ResponseInterface

setLogger()

Sets an optional PSR-3 LoggerInterface

public final setLogger(LoggerInterface $logger) : static
Parameters
$logger : LoggerInterface
Tags
inheritDoc
codeCoverageIgnore
Return values
static

setRequestFactory()

Sets an optional PSR-17 RequestFactoryInterface

public final setRequestFactory(RequestFactoryInterface $requestFactory) : static
Parameters
$requestFactory : RequestFactoryInterface
Tags
inheritDoc
codeCoverageIgnore
Return values
static

setStreamFactory()

Sets an optional PSR-17 StreamFactoryInterface

public final setStreamFactory(StreamFactoryInterface $streamFactory) : static
Parameters
$streamFactory : StreamFactoryInterface
Tags
inheritDoc
codeCoverageIgnore
Return values
static

setUriFactory()

Sets an optional PSR-17 UriFactoryInterface

public final setUriFactory(UriFactoryInterface $uriFactory) : static
Parameters
$uriFactory : UriFactoryInterface
Tags
inheritDoc
codeCoverageIgnore
Return values
static

storeAccessToken()

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

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

cleanBodyParams()

Cleans an array of body parameters

protected cleanBodyParams(iterable<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : iterable<string|int, mixed>
Return values
array<string|int, mixed>

cleanQueryParams()

Cleans an array of query parameters

protected cleanQueryParams(iterable<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : iterable<string|int, mixed>
Return values
array<string|int, mixed>

construct()

A replacement constructor that you can call in extended classes, so that you don't have to implement the monstrous original `__construct()`

protected construct() : void

createAccessToken()

Creates an access token with the provider set to $this->serviceName

protected createAccessToken() : AccessToken
Tags
codeCoverageIgnore
Return values
AccessToken

getRequestBody()

Prepares the request body

protected getRequestBody(StreamInterface|array<string|int, mixed>|string $body, RequestInterface $request) : StreamInterface
Parameters
$body : StreamInterface|array<string|int, mixed>|string
$request : RequestInterface
Tags
throws
ProviderException
Return values
StreamInterface

getRequestHeaders()

Prepare request headers

protected getRequestHeaders([array<string|int, mixed>|null $headers = null ]) : array<string|int, mixed>
Parameters
$headers : array<string|int, mixed>|null = null
Return values
array<string|int, mixed>

getRequestTarget()

Determine the request target from the given URI (path segment or URL) with respect to $apiURL, anything except host and path will be ignored, scheme will always be set to "https".

protected getRequestTarget(string $uri) : string

Throws if the host of a given URL does not match the host of $apiURL.

Parameters
$uri : string
Tags
see
OAuthInterface::request()
throws
ProviderException
Return values
string

getRequestURL()

Prepares the request URL

protected getRequestURL(string $path[, array<string|int, mixed>|null $params = null ]) : string
Parameters
$path : string
$params : array<string|int, mixed>|null = null
Return values
string

getSignature()

Generates a request signature

protected getSignature(UriInterface|string $url, array<string|int, mixed> $params, string $method[, string|null $accessTokenSecret = null ]) : string
Parameters
$url : UriInterface|string
$params : array<string|int, mixed>
$method : string
$accessTokenSecret : string|null = null
Tags
see
https://datatracker.ietf.org/doc/html/rfc5849#section-3.4
throws
ProviderException
Return values
string

parseTokenResponse()

Parses the response from a request to the token endpoint

protected parseTokenResponse(ResponseInterface $response[, bool $confirmCallback = false ]) : AccessToken

Note: "oauth_callback_confirmed" is only sent in request token response

Parameters
$response : ResponseInterface
$confirmCallback : bool = false
Tags
see
https://datatracker.ietf.org/doc/html/rfc5849#section-2.1
see
https://datatracker.ietf.org/doc/html/rfc5849#section-2.3
throws
ProviderException
Return values
AccessToken

sendAccessTokenRequest()

Sends the access token request

protected sendAccessTokenRequest(string $verifier) : ResponseInterface
Parameters
$verifier : string
Return values
ResponseInterface

sendRequestTokenRequest()

Sends a request to the request token endpoint

protected sendRequestTokenRequest(string $url) : ResponseInterface
Parameters
$url : string
Return values
ResponseInterface

        
On this page

Search results