ChilliCream / ChilliCream/graphql-platform

Unauthorized on dotnet graph init with bearer token

Open
#8,266 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ strawberry shake
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Product

Strawberry Shake

Version

15.1.3

Link to minimal reproduction

https://pastebin.com/4XBLwwPY

Steps to reproduce
  1. Get a token from your identity provider
  2. execute dotnet graphql init https://my-url/graphql --scheme Bearer --token $Token
What is expected?

The graphql schema of the graphql server should be loaded and saved locally.

What is actually happening?

I get an unauthorized error and not schema is loaded.

Relevant log output
Download schema started.
error HTTP_ERROR: Response status code does not indicate success: 401 (Unauthorized).
Additional context

The token i used for the test is valid and has enough rights.
i tested it by doing a curl requests with the introspection query from this page:
http://nathanrandal.com/graphql-visualizer/

I already talked with someone from the hot chocolate slack channel who told me that it is because strawberryshake is sending the scheme Bearer in lower case. Therefore I assume "bearer" is send in the authorization header.

The workaround would be to load the schema on my own, save it into a file and do the init step with the file.
This is possible but it would be cleaner if the init command would work with bearer tokens.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Strawberry Shake dotnet graphql init command and reproduce the request using the bearer-token example from the issue. Trace how the command builds the authorization header and verify the behavior against the provided valid token. Done means the schema loads and is saved locally without a 401 response.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
authentication, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.