GitHub API Fetch Repositories Failing with 401 Unauthorized in Auth0 Integration #142517
Replies: 1 comment
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
I’m developing a React application where I am integrating Auth0 by Okta for GitHub authentication. Users can log in via GitHub, and I want to fetch their repositories using the GitHub API to display on the home screen.
The issue arises when the access token is successfully generated after GitHub authentication, but when I attempt to fetch the repositories using that token, I receive a 401 Unauthorized error from the GitHub API. Upon checking the token using jwt.io, I found that the signature of the token appears invalid, even though I’ve configured the repo scope correctly in both Auth0 and the GitHub Developer settings. I'm unsure whether there are additional steps required for proper configuration in Auth0 or GitHub to include the repo scope and validate the token signature correctly.
What I tried: I configured GitHub authentication with Auth0, requested the repo scope, and obtained the access token after logging in.
What I expected to happen: I expected to fetch the logged-in user's repositories from the GitHub API using the access token.
What actually happened: When I attempted to fetch the repositories using the token, the GitHub API returned a 401 Unauthorized error. Upon further investigation, I checked the token on jwt.io and found that its signature was invalid.
Questions:
Why is the GitHub API returning a 401 Unauthorized when the access token seems to be generated correctly?
Are there any additional settings I need to configure in Auth0 or GitHub to ensure the repo scope is included in the access token?
Please refer to this repository for code - https://github.com/Sourish2003/react_app
Beta Was this translation helpful? Give feedback.
All reactions