Github-readme-stats: Could not resolve to a User with the login of 'google'.

Created on 24 Jul 2020  路  7Comments  路  Source: anuraghazra/github-readme-stats

Describe the bug
A clear and concise description of what the bug is.
is not working
github stats

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots / Live demo link (paste the github-readme-stats link as markdown image)
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Most helpful comment

Yes, @filiptronicek github orgs are not normal users you cannot fetch those stats in organization.

We would just show a error and fallback by querying the organization. As we did in repo card.

All 7 comments

Hi @rmdhfz thanks for opening the issue.

Well Google is not an user, it's an organization

I also wanted to note this, I'll try to look into that. Should display a custom error. @anuraghazra

Looks like it's not natively possible (AFAIK), but there could be a simple solution to this, if the lookup of the user fails, we could just query

{
  organization(login: "google") {
    name
  }
}

and look for errors there.

Yes, @filiptronicek github orgs are not normal users you cannot fetch those stats in organization.

We would just show a error and fallback by querying the organization. As we did in repo card.

Looks like it's not natively possible (AFAIK), but there could be a simple solution to this, if the lookup of the user fails, we could just query

{
  organization(login: "google") {
    name
  }
}

and look for errors there.

@filiptronicek so turns out we need to give our PAT tokens read:org permissions to be able to fetch the organization query

Your token has not been granted the required scopes to execute this query. The 'login' field requires one of the following scopes: ['read:org'], but your token has only been granted the: ['gist', 'repo', 'user'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens.

That's a bummer, what about having a PAT just for this? Then we won't have to create new ones again @anuraghazra

That's a bummer, what about having a PAT just for this?

It would make the fetcher unnecessarily complex just to fetch that once piece of information with a different PAT & we also have to then make two requests to the API.

Then we won't have to create new ones again @anuraghazra

We don't have to create new PATs we just need to regenerate them with new scopes.

So i think we have to solution

  1. Regenerate PATs
  2. If the user enters Organization username then github will throw the Could not resolve to a User with the login of 'google'. so we can just simply add another warning text to say "Make sure the provided username is not an organization"
Was this page helpful?
0 / 5 - 0 ratings

Related issues

nathanchu picture nathanchu  路  6Comments

IvanHornung picture IvanHornung  路  3Comments

Math-O5 picture Math-O5  路  5Comments

nathanchu picture nathanchu  路  5Comments

anuraghazra picture anuraghazra  路  3Comments