Closed Zoly closed 1 month ago
The recent updates to the GithubOAuth
class significantly improve how user email information is managed. A new API endpoint for fetching user emails is introduced, enhancing the accuracy and reliability of email retrieval. Modifications to existing methods ensure that if user emails are absent from the initial response, they can be fetched seamlessly. Overall, these changes bolster the class's capability to handle user data efficiently.
Files | Change Summary |
---|---|
src/Libraries/GithubOAuth.php |
Introduced API_USER_EMAILS_URL , modified fetchUserInfoWithToken() to fetch emails when absent, added fetchUserEmailsWithToken() for API calls, and implemented getUserPrimaryEmail() to determine the primary email. |
🐰 In the land of code where the bunnies play,
New email pathways brighten the way!
With tokens and fetches, we hop with glee,
Ensuring each user is as neat as can be.
So here’s to the changes, a joyful cheer,
For emails are gathered, let’s all give a cheer! 🎉
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
Bug Fixes