Authentication Steps for GitHub Enterprise


I have an enterprise GitHub at

I’ve sent it this request, with <my Personal Access Token with Repo Access> filled with an actual personal access token, to find the enterprise, non-private repos that currently have the topic “go” (which definitely exist).

curl -H "Content-Type: application/json" -H "Authorization: token <my Personal Access Token with Repo Access>“ -i -X -d “{ \”query\”: \”query { search(type: REPOSITORY, query:\"topic:go\”, first: 10) { edges { node { ... on Repository { name }}}}}\”}"

After much fiddling with the query and the header to ensure my token was recognised (well, the multiple I generated while trying to get “Good crendentials”), I ended up with this error:

  "message": "Bad credentials",
  "documentation_url": ""

Other Details: We haven’t yet used the API, so if the sysadmin (who is also having issues with accessing this) had to enable or disable something, it probably wasn’t configured as such. We do have a corporate firewall and essentially mandate SSH, but neither of those are issues for me personally when cloning, pulling, pushing, etc.

What am I missing or otherwise doing wrong?


Hey @maguirja!

Can you give this curl a shot? If it doesn’t work, could you show me the verbose output? (minus any sensitive information)

curl -d "{\"query\": \"query { viewer { login } }\"}" --header "authorization:bearer <TOKEN>" -H "Accept: application/vnd.github.v4.idl" -v

This is the curl that I typically use. The main differences I see between mine and yours are:

  1. bearer instead of token in the Authorization header
  2. the Accept header is required for the GraphQL API

Let me know if this works!