Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
OauthInterface Interface Reference
Inheritance diagram for OauthInterface:
Oauth

Public Member Functions

 getRequestToken ($params, $requestUrl, $httpMethod='POST')
 
 getAccessToken ($params, $requestUrl, $httpMethod='POST')
 
 validateAccessTokenRequest ($params, $requestUrl, $httpMethod='POST')
 
 validateAccessToken ($accessToken)
 

Data Fields

const ERR_OK = 0
 
const ERR_VERSION_REJECTED = 1
 
const ERR_PARAMETER_ABSENT = 2
 
const ERR_PARAMETER_REJECTED = 3
 
const ERR_TIMESTAMP_REFUSED = 4
 
const ERR_NONCE_USED = 5
 
const ERR_SIGNATURE_METHOD_REJECTED = 6
 
const ERR_SIGNATURE_INVALID = 7
 
const ERR_CONSUMER_KEY_REJECTED = 8
 
const ERR_TOKEN_USED = 9
 
const ERR_TOKEN_EXPIRED = 10
 
const ERR_TOKEN_REVOKED = 11
 
const ERR_TOKEN_REJECTED = 12
 
const ERR_VERIFIER_INVALID = 13
 
const ERR_PERMISSION_UNKNOWN = 14
 
const ERR_PERMISSION_DENIED = 15
 
const ERR_METHOD_NOT_ALLOWED = 16
 
const ERR_CONSUMER_KEY_INVALID = 17
 
const SIGNATURE_SHA1 = 'HMAC-SHA1'
 
const SIGNATURE_SHA256 = 'HMAC-SHA256'
 

Detailed Description

OauthInterface provides methods consistent with implementing a 2-legged OAuth authentication mechanism. Methods include creating a request token, getting an access token, and performing certain validations on tokens and token requests. A method is also included for generating an OAuth header that can be used in an HTTP request.

@api

Since
100.0.2

Definition at line 16 of file OauthInterface.php.

Member Function Documentation

◆ getAccessToken()

getAccessToken (   $params,
  $requestUrl,
  $httpMethod = 'POST' 
)

Get access token for a pre-authorized request token.

Parameters
array$params- Array containing parameters necessary for requesting Access Token.
array (
        'oauth_version' => '1.0',
        'oauth_signature_method' => 'HMAC-SHA1',
        'oauth_token' => 'a6aa81cc3e65e2960a487939244sssss',
        'oauth_nonce' => 'rI7PSWxTZRHWU3R',
        'oauth_timestamp' => '1377183099',
        'oauth_consumer_key' => 'a6aa81cc3e65e2960a4879392445e718',
        'oauth_signature' => 'VNg4mhFlXk7%2FvsxMqqUd5DWIj9s%3D',
        'oauth_verifier' => 'a6aa81cc3e65e2960a487939244vvvvv'
)
string$requestUrl- The request Url.
string$httpMethod- (default: 'POST')
Returns
array - The access token/secret pair.
array (
        'oauth_token' => 'gshsjkndtyhwjhdbutfgbsnhtrequikf',
        'oauth_token_secret' => 'gshsjkndtyhwjhdbutfgbsnhtrequikf'
)
Exceptions

Implemented in Oauth.

◆ getRequestToken()

getRequestToken (   $params,
  $requestUrl,
  $httpMethod = 'POST' 
)

#- Issue a pre-authorization request token to the caller.

Parameters
array$params- Array containing parameters necessary for requesting Request Token.
array (
        'oauth_version' => '1.0',
        'oauth_signature_method' => 'HMAC-SHA1',
        'oauth_nonce' => 'rI7PSWxTZRHWU3R',
        'oauth_timestamp' => '1377183099',
        'oauth_consumer_key' => 'a6aa81cc3e65e2960a4879392445e718',
        'oauth_signature' => 'VNg4mhFlXk7%2FvsxMqqUd5DWIj9s%3D'
)
string$requestUrl- The request Url.
string$httpMethod- (default: 'POST')
Returns
array - The request token/secret pair.
array (
        'oauth_token' => 'gshsjkndtyhwjhdbutfgbsnhtrequikf',
        'oauth_token_secret' => 'gshsjkndtyhwjhdbutfgbsnhtrequikf'
)
Exceptions

Implemented in Oauth.

◆ validateAccessToken()

validateAccessToken (   $accessToken)

Validate an access token string.

Parameters
string$accessToken- The access token.
Returns
int - Consumer ID if the access token is valid.
Exceptions

Implemented in Oauth.

◆ validateAccessTokenRequest()

validateAccessTokenRequest (   $params,
  $requestUrl,
  $httpMethod = 'POST' 
)

Validate an access token request.

Parameters
array$params- Array containing parameters necessary for validating Access Token.
array (
        'oauth_version' => '1.0',
        'oauth_signature_method' => 'HMAC-SHA1',
        'oauth_token' => 'a6aa81cc3e65e2960a487939244sssss',
        'oauth_nonce' => 'rI7PSWxTZRHWU3R',
        'oauth_timestamp' => '1377183099',
        'oauth_consumer_key' => 'a6aa81cc3e65e2960a4879392445e718',
        'oauth_signature' => 'VNg4mhFlXk7%2FvsxMqqUd5DWIj9s%3D'
)
string$requestUrl- The request Url.
string$httpMethod- (default: 'POST')
Returns
int Consumer ID.
Exceptions

Implemented in Oauth.

Field Documentation

◆ ERR_CONSUMER_KEY_INVALID

const ERR_CONSUMER_KEY_INVALID = 17

Definition at line 55 of file OauthInterface.php.

◆ ERR_CONSUMER_KEY_REJECTED

const ERR_CONSUMER_KEY_REJECTED = 8

Definition at line 37 of file OauthInterface.php.

◆ ERR_METHOD_NOT_ALLOWED

const ERR_METHOD_NOT_ALLOWED = 16

Definition at line 53 of file OauthInterface.php.

◆ ERR_NONCE_USED

const ERR_NONCE_USED = 5

Definition at line 31 of file OauthInterface.php.

◆ ERR_OK

const ERR_OK = 0

#+ OAuth result statuses

Definition at line 21 of file OauthInterface.php.

◆ ERR_PARAMETER_ABSENT

const ERR_PARAMETER_ABSENT = 2

Definition at line 25 of file OauthInterface.php.

◆ ERR_PARAMETER_REJECTED

const ERR_PARAMETER_REJECTED = 3

Definition at line 27 of file OauthInterface.php.

◆ ERR_PERMISSION_DENIED

const ERR_PERMISSION_DENIED = 15

Definition at line 51 of file OauthInterface.php.

◆ ERR_PERMISSION_UNKNOWN

const ERR_PERMISSION_UNKNOWN = 14

Definition at line 49 of file OauthInterface.php.

◆ ERR_SIGNATURE_INVALID

const ERR_SIGNATURE_INVALID = 7

Definition at line 35 of file OauthInterface.php.

◆ ERR_SIGNATURE_METHOD_REJECTED

const ERR_SIGNATURE_METHOD_REJECTED = 6

Definition at line 33 of file OauthInterface.php.

◆ ERR_TIMESTAMP_REFUSED

const ERR_TIMESTAMP_REFUSED = 4

Definition at line 29 of file OauthInterface.php.

◆ ERR_TOKEN_EXPIRED

const ERR_TOKEN_EXPIRED = 10

Definition at line 41 of file OauthInterface.php.

◆ ERR_TOKEN_REJECTED

const ERR_TOKEN_REJECTED = 12

Definition at line 45 of file OauthInterface.php.

◆ ERR_TOKEN_REVOKED

const ERR_TOKEN_REVOKED = 11

Definition at line 43 of file OauthInterface.php.

◆ ERR_TOKEN_USED

const ERR_TOKEN_USED = 9

Definition at line 39 of file OauthInterface.php.

◆ ERR_VERIFIER_INVALID

const ERR_VERIFIER_INVALID = 13

Definition at line 47 of file OauthInterface.php.

◆ ERR_VERSION_REJECTED

const ERR_VERSION_REJECTED = 1

Definition at line 23 of file OauthInterface.php.

◆ SIGNATURE_SHA1

const SIGNATURE_SHA1 = 'HMAC-SHA1'

#- #+ Signature Methods

Definition at line 62 of file OauthInterface.php.

◆ SIGNATURE_SHA256

const SIGNATURE_SHA256 = 'HMAC-SHA256'

Definition at line 64 of file OauthInterface.php.


The documentation for this interface was generated from the following file: