# GitHub API Fetch Repositories Failing with 401 Unauthorized in Auth0 Integration

**URL:** <https://community.auth0.com/t/github-api-fetch-repositories-failing-with-401-unauthorized-in-auth0-integration/150442>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [October 24, 2024, 9:04pm UTC](https://community.auth0.com/t/github-api-fetch-repositories-failing-with-401-unauthorized-in-auth0-integration/150442 "2024-10-24T21:04:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sourish666](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sourish666/32/61697_2.png) [@sourish666](https://community.auth0.com/u/sourish666)\
**Post date:** [October 24, 2024, 9:04pm UTC](https://community.auth0.com/t/github-api-fetch-repositories-failing-with-401-unauthorized-in-auth0-integration/150442/1 "2024-10-24T21:04:44Z")

</div>

I’m currently working on a React application where I’m integrating Auth0 for authentication, including GitHub login. I want users to log in via GitHub and then display their repositories on the home screen by fetching them from the GitHub API.

Problem:

The access token is being successfully generated when I authenticate via GitHub, but when I attempt to fetch the repositories using the token, I get a 401 Unauthorized error from the GitHub API.

Upon verifying the github token in [jwt.io](http://jwt.io) it seems that token signature is invalid.

Auth0 Settings:

I’ve configured the GitHub connection in Auth0 to use repo scope.

GitHub Developer Settings:

The GitHub OAuth App is set up with the correct Client ID and Client Secret in Auth0. The OAuth app is requesting the repo scope and is registered in the GitHub Developer settings.

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 - [GitHub - Sourish2003/react\_app](https://github.com/Sourish2003/react_app)

---

<div class="post-metadata">

**Author:** ![ale.vesga1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ale.vesga1/32/60921_2.png) [@ale.vesga1](https://community.auth0.com/u/ale.vesga1)\
**Post date:** [October 24, 2024, 11:20pm UTC](https://community.auth0.com/t/github-api-fetch-repositories-failing-with-401-unauthorized-in-auth0-integration/150442/3 "2024-10-24T23:20:20Z")

</div>

Hi @sourish666,

Welcome to the Auth0 by Okta Community!

It sounds like you are running into issues with the GitHub Social Connection.

This error could be caused by an incorrectly configured Allowed Callback URL. It should be configured as `https://YOUR_DOMAIN/login/callback.`

If you are still receiving a 401, it may be due to incorrectly configured permissions for the user during login. This link shows how to add those scopes to the user: [https://auth0.com/docs/authenticate/identity-providers/adding-scopes-for-an-external-idp](https://auth0.com/docs/authenticate/identity-providers/adding-scopes-for-an-external-idp)

For further guidance on configuring the GitHub connection in Auth0, you can refer to this link: [(https://marketplace.auth0.com/integrations/github-social-connection)](https://marketplace.auth0.com/integrations/github-social-connection).

Please let me know if you have any further questions.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 7, 2024, 11:21pm UTC](https://community.auth0.com/t/github-api-fetch-repositories-failing-with-401-unauthorized-in-auth0-integration/150442/4 "2024-11-07T23:21:06Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
