Urigo / graphql-cli

📟 Command line tool for common GraphQL development workflows

Home Page:https://graphql-cli.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unauthenticated

john012343210 opened this issue · comments

Describe the bug
GraphQL Error (Code: 401): {"response":{"message":"This endpoint requires you to be authenticated.","documentation_url":"https://developer.github.com/v3/#authentication","status":401},"request":{"query":"\n query IntrospectionQuery {\n __schema {\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n description\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n description\n fields(includeDeprecated: true) {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n description\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n description\n type { ...TypeRef }\n defaultValue\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }\n "}}

To Reproduce

Here is my .graphqlconfig

{
  "projects": {
    "graphqlProjectTestingGraphql": {
      "schemaPath": "schema.graphql",
      "extensions": {
        "endpoints": {

          "headers": {
            "url": "https://api.github.com/graphql",
            "Authorization": "Bearer '<MY_TOKE_NHERE>'"
          }
        }
      }
    }
  }
}

AND THEN RUN graphql get-schema

question
Am I setting anything wrong in my config json?
__I actually don't understand why the error message tries to direct me to GitHub v3 API , but my endpoint is clearly v4 graphql.

I just solve it by altering the config file

{
  "projects": {
    "graphqlProjectTestingGraphql": {
      "schemaPath": "schema.graphql",
      "extensions": {
        "endpoints": {
          "dev": {
            "url": "https://api.github.com/graphql",
            "headers": {
              "Authorization": "Bearer <MyToken>"
            }

          }
        }
      }
    }
  }}