You are here

private function BackupMigrateDropboxAPI::get_code_challenge in Backup and Migrate Dropbox 7.3

Returns the code challenge for the given code verifier.

@link https://dropbox.tech/developers/pkce--what-and-why-

Parameters

string $code_verifier:

Return value

string The code challenge: the sha256 hashed code verifier.

1 call to BackupMigrateDropboxAPI::get_code_challenge()
BackupMigrateDropboxAPI::get_authorize_url in ./backup_migrate_dropbox.dropbox_api.inc
Returns the (parameterized) authorize URL.

File

./backup_migrate_dropbox.dropbox_api.inc, line 133

Class

BackupMigrateDropboxAPI
BackupMigrateDropboxAPI contains all the details about the Dropbox api, authorization calls, endpoints, uris, parameters, error handling, and split requests for large uploads/downloads

Code

private function get_code_challenge($code_verifier) {
  if ($code_verifier === NULL) {
    throw new RuntimeException("Cannot create a code challenge when no code verifier is available.");
  }
  return $this
    ->base64_url_encode(hash('sha256', $code_verifier, TRUE));
}