OAuth

class DreamCommerce\ShopAppstoreLib\Client\OAuth

An adapter for OAuth requests.

This class implements DreamCommerce\ShopAppstoreLib\ClientInterface.

methods

DreamCommerce\ShopAppstoreLib\Client\OAuth::__construct($options =[])

constructor

Parameters:
  • $options (array) – object instantiation options
Throws:

ClientOAuthException

Available options keys:

entrypoint
shop URL
client_id
application identifier
client_secret
application secret
auth_code
authentication code used for access token exchange
refresh_token
refresh token used for access token update
DreamCommerce\ShopAppstoreLib\Client\OAuth::refreshTokens()

Refreshes access tokens. (implies setting refresh_token in __construct or setRefreshToken)

Return type:array
Returns:new tokens
DreamCommerce\ShopAppstoreLib\Client\OAuth::getClientId()

Gets supplied application identifier.

Return type:string|null
Returns:identifier
DreamCommerce\ShopAppstoreLib\Client\OAuth::setClientId($clientId)

Sets application identifier.

Parameters:
  • $clientId (string) – identifier
Return type:

OAuth

Returns:

chain

DreamCommerce\ShopAppstoreLib\Client\OAuth::getClientSecret()

Gets supplied application secret.

Return type:string|null
Returns:secret
DreamCommerce\ShopAppstoreLib\Client\OAuth::setClientSecret($clientSecret)

Sets application secret.

Parameters:
  • $clientSecret (string) – secret
Return type:

OAuth

Returns:

chain

DreamCommerce\ShopAppstoreLib\Client\OAuth::getAuthCode()

Gets supplied authentication code.

Return type:string
Returns:code
Throws:ClientException
DreamCommerce\ShopAppstoreLib\Client\OAuth::setAuthCode($authCode)

Sets authentication code.

Parameters:
  • $authCode (string) – code
Return type:

OAuth

Returns:

chain

DreamCommerce\ShopAppstoreLib\Client\OAuth::getRefreshToken()

Gets supplied refresh token.

Return type:string
Returns:token
Throws:ClientException
DreamCommerce\ShopAppstoreLib\Client\OAuth::setRefreshToken($refreshToken)

Sets refresh token.

Parameters:
  • $refreshToken (string) – token
Return type:

OAuth

Returns:

chain

DreamCommerce\ShopAppstoreLib\Client\OAuth::getScopes()

Gets granted scopes list.

Return type:array
Returns:scopes