You are here

public static function SimpleOauthTestTrait::base64urlencode in Simple OAuth (OAuth2) & OpenID Connect 8.4

Same name and namespace in other branches
  1. 5.x tests/src/Functional/SimpleOauthTestTrait.php \Drupal\Tests\simple_oauth\Functional\SimpleOauthTestTrait::base64urlencode()

Base64 url encode.

Parameters

string $string: The string to encode.

Return value

string The encoded string.

1 call to SimpleOauthTestTrait::base64urlencode()
AuthCodeFunctionalTest::testClientAuthCodeGrantWithPkce in tests/src/Functional/AuthCodeFunctionalTest.php
Test the AuthCode grant with PKCE.

File

tests/src/Functional/SimpleOauthTestTrait.php, line 78

Class

SimpleOauthTestTrait
Trait with methods needed by tests.

Namespace

Drupal\Tests\simple_oauth\Functional

Code

public static function base64urlencode($string) {
  $base64 = base64_encode($string);
  $base64 = rtrim($base64, "=");
  return strtr($base64, '+/', '-_');
}