Skip to content

Commit

Permalink
Update getProfile
Browse files Browse the repository at this point in the history
  • Loading branch information
kendallstrautman committed Oct 15, 2024
1 parent 9315407 commit 4d4a8c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 31 deletions.
6 changes: 4 additions & 2 deletions lib/SSO.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ public function getProfile($accessToken)
null
);

$response = new Resource\Response($result, $responseHeaders, $responseCode);
$decodedResponse = json_decode($result, true);

return $response->json();
$profile = Resource\Profile::constructFromResponse($decodedResponse);

return $profile->json();
}

/**
Expand Down
29 changes: 0 additions & 29 deletions tests/WorkOS/SSOTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,35 +113,6 @@ public function testGetProfileAndTokenReturnsProfileWithExpectedValues()
$this->assertEquals($profileFixture, $profileAndToken->profile->toArray());
}

public function testGetProfileReturnsProfileWithExpectedValues()
{
$code = 'code';
$path = "sso/token";
$params = [
"client_id" => WorkOS::getClientId(),
"client_secret" => WorkOS::getApikey(),
"code" => $code,
"grant_type" => "authorization_code"
];

$result = $this->profileAndTokenResponseFixture();

$this->mockRequest(
Client::METHOD_POST,
$path,
null,
$params,
false,
$result
);

$profileAndToken = $this->sso->getProfileAndToken('code');
$profile = $this->sso->getProfile($profileAndToken->accessToken);
$profileFixture = $this->profileFixture();

$this->assertSame("01DMEK0J53CVMC32CK5SE0KZ8Q", $profileAndToken->accessToken);
$this->assertEquals($profileFixture, $profile->toArray());
}

public function testGetConnection()
{
Expand Down

0 comments on commit 4d4a8c8

Please sign in to comment.