Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Android Studio cannot load GitHub account information

ErrorCannot load information for GitHub account: Bad credentials

Short answer

The IDE sends the token saved in Settings > Version Control > GitHub to GitHub, and GitHub refused it. The token expired, was deleted, lacks a needed scope, or has not been authorized for your organization. Create a new token with the scopes the IDE lists, then add it again with Log In with Token.

  • Applies to Android Studio current stable, GitHub.com, macOS 26
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Test the token outside the IDE. GitHub answers invalid credentials with 401 Unauthorized. Any other answer means the token itself is accepted and the problem is a scope or organization setting.

    curl -s -o /dev/null -w "%{http_code}\n" \
      -H "Authorization: Bearer YOUR_TOKEN" https://api.github.com/user
  2. 2Match what you see, then jump to its fix

    1. 1The curl test prints 401The saved token expired or was deletedFix
    2. 2The curl test does not print 401, but the IDE still reports an error for repositories or organizationsThe token is missing a scope the IDE needsFix
    3. 3Your own repositories load, but the organization's repositories fail (GitHub sends an X-GitHub-SSO header on such refusals)The organization uses SAML single sign-on and the token is not authorizedFix

What does the error look like?

  • Cannot load information for GitHub account: Bad credentials
  • Bad credentials

Cause 1 of 3

The saved token expired or was deleted

1Check

On GitHub open your profile picture, Settings, Developer settings, Personal access tokens. A token you set to expire, or one you deleted, is gone from the list or marked expired. GitHub also removes tokens that have not been used for a year.

curl -s -H "Authorization: Bearer YOUR_TOKEN" https://api.github.com/user | head -n 4

2Fix

Generate a new token (classic: Generate new token, then Generate new token (classic)). In Android Studio open Settings > Version Control > GitHub, click Add, choose Log In with Token and paste it. Or choose Log In via GitHub to sign in through the browser instead of using a token.

# in the browser: GitHub > Settings > Developer settings > Personal access tokens
# in the IDE: Settings > Version Control > GitHub > Add > Log In with Token

3Verify

The account row in the GitHub settings page shows your username, and the curl test no longer prints 401.

curl -s -o /dev/null -w "%{http_code}\n" \
  -H "Authorization: Bearer YOUR_NEW_TOKEN" https://api.github.com/user

Confirmed by docs.github.com

Did this fix it?

Cause 2 of 3

The token is missing a scope the IDE needs

1Check

JetBrains lists the scopes the IDE expects: repo, gist, read:org, workflow, read:user and user:email. A fine-grained token is not fully supported out of the box, and the IDE shows an error when a permission is missing.

curl -s -D - -o /dev/null -H "Authorization: Bearer YOUR_TOKEN" https://api.github.com/user | grep -i x-oauth-scopes

2Fix

Create a classic token with all six scopes ticked and add it in the IDE with Log In with Token. If you use a fine-grained token, grant permissions equal to those scopes.

# scopes to tick on the classic token page
repo, gist, read:org, workflow, read:user, user:email

3Verify

The x-oauth-scopes header lists those scopes, and the IDE loads your repositories.

curl -s -D - -o /dev/null -H "Authorization: Bearer YOUR_NEW_TOKEN" https://api.github.com/user | grep -i x-oauth-scopes

Confirmed by jetbrains.com

Did this fix it?

Cause 3 of 3

The organization uses SAML single sign-on and the token is not authorized

1Check

For resources owned by an organization with SAML single sign-on, the token itself has to be authorized for that organization.

curl -s -o /dev/null -w "%{http_code}\n" -H "Authorization: Bearer YOUR_TOKEN" https://api.github.com/orgs/YOUR_ORG/repos

2Fix

In GitHub, open Settings > Developer settings > Personal access tokens, find the token, and authorize it for the organization. GitHub's Enterprise Cloud documentation has the exact steps.

# in the browser: token list > Configure SSO > Authorize

3Verify

The organization request no longer returns 401 or 404 and the repositories show up in the IDE.

curl -s -o /dev/null -w "%{http_code}\n" -H "Authorization: Bearer YOUR_TOKEN" https://api.github.com/orgs/YOUR_ORG/repos

Confirmed by docs.github.com

Did this fix it?

How do I stop it coming back?

  • Prefer Log In via GitHub (OAuth) over a pasted token, so there is no token to expire.
  • If you use a token with an expiry date, put the date in your calendar.
  • Never commit a token to a repository; keep it in the IDE's saved accounts.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Android Studio cannot pair the phone over Wi-Fi

The Pair devices over Wi-Fi dialog lists no device

Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.

4 causes, each with a fix

Mobile apps

adb tcpip 5555 fails because no device is found

adb: more than one device/emulator

adb tcpip only works while the device is attached and listed by adb, because it tells the phone to start listening on port 5555.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.