class DropboxAuthHelper (View source)

Constants

CSRF_LENGTH

The length of CSRF string

Properties

protected OAuth2Client $oAuth2Client OAuth2 Client
protected RandomStringGeneratorInterface $randomStringGenerator Random String Generator
protected PersistentDataStoreInterface $persistentDataStore Persistent Data Store
protected string $urlState Additional User Provided State

Methods

__construct(OAuth2Client $oAuth2Client, RandomStringGeneratorInterface $randomStringGenerator = null, PersistentDataStoreInterface $persistentDataStore = null)

Create a new DropboxAuthHelper instance

getOAuth2Client()

Get OAuth2Client

getRandomStringGenerator()

Get the Random String Generator

getPersistentDataStore()

Get the Persistent Data Store

string
getCsrfToken()

Get CSRF Token

string
getAuthUrl(string $redirectUri, array $params = array(), string $urlState = null)

Get Authorization URL

array
decodeState(string $state)

Decode State to get the CSRF Token and the URL State

void
validateCSRFToken(string $csrfToken)

Validate CSRF Token

getAccessToken(string $code, string $state, string $redirectUri)

Get Access Token

void
revokeAccessToken()

Revoke Access Token

string
getUrlState()

Get URL State

Details

at line line 53
__construct(OAuth2Client $oAuth2Client, RandomStringGeneratorInterface $randomStringGenerator = null, PersistentDataStoreInterface $persistentDataStore = null)

Create a new DropboxAuthHelper instance

Parameters

OAuth2Client $oAuth2Client
RandomStringGeneratorInterface $randomStringGenerator
PersistentDataStoreInterface $persistentDataStore

at line line 68
OAuth2Client getOAuth2Client()

Get OAuth2Client

Return Value

OAuth2Client

at line line 78
RandomStringGeneratorInterface getRandomStringGenerator()

Get the Random String Generator

at line line 88
PersistentDataStoreInterface getPersistentDataStore()

Get the Persistent Data Store

at line line 98
protected string getCsrfToken()

Get CSRF Token

Return Value

string

at line line 116
string getAuthUrl(string $redirectUri, array $params = array(), string $urlState = null)

Get Authorization URL

Parameters

string $redirectUri Callback URL to redirect to after authorization
array $params Additional Params
string $urlState Additional User Provided State Data

Return Value

string

at line line 141
protected array decodeState(string $state)

Decode State to get the CSRF Token and the URL State

Parameters

string $state State

Return Value

array

at line line 164
protected void validateCSRFToken(string $csrfToken)

Validate CSRF Token

Parameters

string $csrfToken CSRF Token

Return Value

void

Exceptions

DropboxClientException

at line line 191
AccessToken getAccessToken(string $code, string $state, string $redirectUri)

Get Access Token

Parameters

string $code Authorization Code
string $state CSRF & URL State
string $redirectUri Redirect URI used while getAuthUrl

Return Value

AccessToken

at line line 217
void revokeAccessToken()

Revoke Access Token

Return Value

void

at line line 227
string getUrlState()

Get URL State

Return Value

string