You are here

public function PasswordGrantTest::testThatPasswordGrantRealmLoginSendsBasicRequestCorrectly in Auth0 Single Sign On 8.2

Test that a basic password grant realm request includes the realm.

Throws

ApiException If username or password is missing.

File

vendor/auth0/auth0-php/tests/API/Authentication/PasswordGrantTest.php, line 138

Class

PasswordGrantTest
Class PasswordGrantTest Tests the Authentication API class, specifically password grants.

Namespace

Auth0\Tests\API\Authentication

Code

public function testThatPasswordGrantRealmLoginSendsBasicRequestCorrectly() {
  $api = new MockAuthenticationApi([
    new Response(200),
  ]);
  $api
    ->call()
    ->login([
    'username' => 'the_username',
    'password' => 'the_password',
    'realm' => 'the_realm',
  ]);
  $this
    ->assertEquals('https://test-domain.auth0.com/oauth/token', $api
    ->getHistoryUrl());
  $request_body = $api
    ->getHistoryBody();
  $this
    ->assertEquals('the_realm', $request_body['realm']);
  $this
    ->assertEquals('http://auth0.com/oauth/grant-type/password-realm', $request_body['grant_type']);
}