Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional Getter Methods For Retrieving User Information #710

Closed
wants to merge 3 commits into from

Conversation

jeramyhing
Copy link

@jeramyhing jeramyhing commented Jul 5, 2024

Description

This PR updates the Laravel\Socialite\AbstractUser and Laravel\Socialite\Two\User classes to add additional getter methods. It also enhances the existing tests to verify that the new getter methods return the correct property values.

Changes

AbstractUser Class Updates

New Getter Method:

  • getAttributes: Get the user's attributes.

Two\User Class Updates:

New Getter Methods:

  • getToken: Retrieves the user's access token.
  • getRefreshToken: Retrieves the user's refresh token.
  • getExpiresIn: Retrieves the number of seconds the access token is valid for.
  • getApprovedScopes: Retrieves the scopes approved by the user during authentication.

Tests:

  • Updated the OAuthOneTest and OAuthTwoTest class to use the new getter methods.
  • Added assertions to verify that the getter methods return the correct property values.

Benefits to End Users

These updates provide more convenient methods for retrieving user information, making it easier to work with user data. The changes are backward-compatible and do not break any existing features. Note that while the Two\User getters enhance data retrieval, the properties still require type-hinting for full static analysis compatibility.

@jeramyhing jeramyhing changed the title Additional Getter Methods For Retrieving User Information #1 Additional Getter Methods For Retrieving User Information Jul 5, 2024
src/Contracts/User.php Outdated Show resolved Hide resolved
@driesvints
Copy link
Member

Please revert the changes to the interface and mark for review again. Thanks.

@driesvints driesvints marked this pull request as draft July 8, 2024 06:50
Additional Getter Methods For Retrieving User Information
@jeramyhing jeramyhing reopened this Jul 8, 2024
@jeramyhing jeramyhing marked this pull request as ready for review July 8, 2024 12:41
@taylorotwell
Copy link
Member

I don't think we need all this for public properties?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants