You are here

protected function AuthCodeFunctionalTest::postGrantedCodeWithScopes in Simple OAuth (OAuth2) & OpenID Connect 8.4

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

Posts the code and requests access to the scopes.

Parameters

string $code: The granted code.

string $scopes: The list of scopes to request access to.

Return value

\Psr\Http\Message\ResponseInterface The response.

3 calls to AuthCodeFunctionalTest::postGrantedCodeWithScopes()
AuthCodeFunctionalTest::testAuthCodeGrant in tests/src/Functional/AuthCodeFunctionalTest.php
Test the valid AuthCode grant.
AuthCodeFunctionalTest::testNon3rdPartyClientAuthCodeGrant in tests/src/Functional/AuthCodeFunctionalTest.php
Test the valid AuthCode grant if the client is non 3rd party.
AuthCodeFunctionalTest::testRememberClient in tests/src/Functional/AuthCodeFunctionalTest.php
Tests the remember client functionality.

File

tests/src/Functional/AuthCodeFunctionalTest.php, line 337

Class

AuthCodeFunctionalTest
The auth code test.

Namespace

Drupal\Tests\simple_oauth\Functional

Code

protected function postGrantedCodeWithScopes($code, $scopes) {
  $valid_payload = [
    'grant_type' => 'authorization_code',
    'client_id' => $this->client
      ->uuid(),
    'client_secret' => $this->clientSecret,
    'code' => $code,
    'scope' => $scopes,
    'redirect_uri' => $this->redirectUri,
  ];
  return $this
    ->post($this->url, $valid_payload);
}