You are here

public static function SimpleOauthTestTrait::base64urlencode in Simple OAuth (OAuth2) & OpenID Connect 5.x

Same name and namespace in other branches
  1. 8.4 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 75

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, '+/', '-_');
}