GitHub API Fetch Repositories Failing with 401 Unauthorized in Auth0 Integration #142517
Unanswered
Sourish2003
asked this question in
API and Webhooks
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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