Closed Zoly closed 4 months ago
The updates to the GithubOAuth
class enhance its ability to manage user email data by introducing a new endpoint for retrieving user email addresses. Key additions include a public static property for the email API URL, a method to fetch user emails when they are not present, and logic to determine the user's primary email address. These improvements streamline integration with GitHub's OAuth services and enrich user data handling.
Files | Change Summary |
---|---|
src/Libraries/GithubOAuth.php |
Added $API_USER_EMAILS_URL property, new methods fetchUserEmailsWithToken() and getUserPrimaryEmail() , and modified fetchUserInfoWithToken() to enhance email retrieval functionality. |
In the meadow where rabbits play,
New changes hop in, brightening the day!
With emails fetched from GitHub's embrace,
Our class now shines with a smiling face.
So here’s to the code, let’s dance and cheer,
For every new feature brings us near! 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
The /user API returns only the data the user explicitly set as public and null for those he didn't.
If the user did not set the email address public (me for example), the email address being mandatory for the process, the authentication fails returning an error message.
By using the /user/emails API in conjunction, it is possible to retrieve all the email addresses the user set in Github, regardless if they are set public or not, and select one of those (ex: primary one), for the login process to complete successfully.
Summary by CodeRabbit
New Features
Improvements