Skip to content

Conversation

@SanderVerkuil
Copy link

The getProfile method was not properly implemented and tested, wrote a test scenario for that to ensure that it works properly now.

Description

Fixed an issue because the json method does not exist on the Profile class.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

The `getProfile` method was not properly implemented and tested, wrote a test scenario for that to ensure that it works properly now.
@SanderVerkuil SanderVerkuil requested a review from a team as a code owner July 10, 2025 10:41
@SanderVerkuil SanderVerkuil requested a review from gcarvelli July 10, 2025 10:41
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Fixed implementation of getProfile() method in lib/SSO.php to correctly handle profile data retrieval and added comprehensive test coverage.

  • Removed incorrect json() method call on Profile object in lib/SSO.php
  • Simplified HTTP request handling by using Client::request directly instead of nested calls
  • Added new test method in tests/WorkOS/SSOTest.php to verify profile data matches expected fixture values
  • Improved error handling for missing profile data in API responses

2 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile

{
$path = "sso/profile";

$result = $this->profileAndTokenResponseFixture();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Using profileAndTokenResponseFixture() for a profile-only test may hide potential issues. Create a separate profileResponseFixture() that matches the actual API response for /sso/profile

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this indeed introduced a bug. Had the proper endpoint now.

lib/SSO.php Outdated
'sso/profile',
null,
null,
true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Document why the 'true' parameter is being passed to request()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not done in other parts of the codebase, so I don't see why I should do it here. Not sure what the maintainers think?

@SanderVerkuil SanderVerkuil force-pushed the fix/sso-profile-improvements branch from 0772e07 to f7dc162 Compare July 15, 2025 13:11
@SanderVerkuil SanderVerkuil force-pushed the fix/sso-profile-improvements branch from f7dc162 to 8764bce Compare July 15, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant