You are here

public static function Utility::base64urlEncode in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/Utility.php \Drupal\oauth2_server\Utility::base64urlEncode()

Encodes a string as base64url.

Parameters

string $data: The string to encode.

Return value

string The encoded data.

1 call to Utility::base64urlEncode()
OAuth2Storage::getAuthorizationCode in src/OAuth2Storage.php
Get authorization code.

File

src/Utility.php, line 82

Class

Utility
Contains utility methods for the OAuth2 Server.

Namespace

Drupal\oauth2_server

Code

public static function base64urlEncode($data) {
  return str_replace([
    '+',
    '/',
  ], [
    '-',
    '_',
  ], base64_encode($data));
}