Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any example to run a simple query against an existing schema using authentication? #659

Open
droslean opened this issue Dec 5, 2022 · 1 comment

Comments

@droslean
Copy link

droslean commented Dec 5, 2022

Is there any example to run a simple query against an existing schema using authentication?

Perhaps I misunderstood what is this library for. My goal is to run a simple query against my graphQL server programmatically using also a Bearer token for authentication.

I am trying to do

       query := `
query MyQuery {
  queryImage {
    id
  }
}
`
	params := graphql.Params{RequestString: query}
	r := graphql.Do(params)
	if len(r.Errors) > 0 {
		log.Fatalf("failed to execute graphql operation, errors: %+v", r.Errors)
	}
	rJSON, _ := json.Marshal(r)
	fmt.Printf("%s \n", rJSON)

The response is always empty.

@droslean
Copy link
Author

droslean commented Dec 5, 2022

@chris-ramon cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant