Closed dariusz-wozniak closed 2 years ago
You can pass your authorization header as an argument:
dotnet graphql update -u https://localhost:5001/graphql -x Authorization="Basic xxx"
When I run dotnet graph --help
, there is nothing about -x
param:
λ dotnet graphql --help
The following commands are supported:
- Initialize project and download schema
dotnet graphql init http://localhost
dotnet graphql init {url} [-p|--Path] [-n|--clientName] [--token] [--scheme] [--tokenEndpoint] [--clientId] [--clientSecret] [--scope]
- Update local schema
dotnet graphql update
dotnet graphql update [-p|--Path] [-u|--uri] [--token] [--scheme] [--tokenEndpoint] [--clientId] [--clientSecret] [--scope]
- Download the schema as GraphQL SDL
dotnet graphql download http://localhost
dotnet graphql download {url} [-f|--FileName] [--token] [--scheme] [--tokenEndpoint] [--clientId] [--clientSecret] [--scope]
And, when I try to use the above command, I get:
λ dotnet graphql update -u https://localhost:5001/graphql -x Authorization="Basic xxx"
Specify --help for a list of available options and commands.
Unhandled exception. McMaster.Extensions.CommandLineUtils.UnrecognizedCommandParsingException: Unrecognized option '-x'
at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.HandleUnexpectedArg(String argTypeName, String argValue)
at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.ProcessOption(OptionArgument arg)
at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.ProcessNext()
at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.Process()
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Parse(String[] args)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
at StrawberryShake.Tools.Program.<Main>(String[] args)
Might be I'm using an older version of the tool, @tobias-tengler? 🤔
λ dotnet tool list
Package Id Version Commands Manifest
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
strawberryshake.tools 11.3.7 dotnet-graphql [...]\.config\dotnet-tools.json
Yes, the latest version should be 12.6.1
Yes, that resolved the issue, thank you 👏
Is there an existing issue for this?
Describe the bug
I have a Basic Authorization enabled for the GraphQL server. I'd like to update schema by running
dotnet graphql update -u https://localhost:5001/graphql
and:1: If Authorization is DISABLED then I get schema updated (correct behaviour):
1: If Authorization is ENABLED then I get schema updated (incorrect behaviour):
Code for the authorization:
Please allow to authorize CLI via Basic.
Steps to reproduce
dotnet graphql update -u https://localhost:5001/graphql
on server where Basic Auth is enabled.Relevant log output
No response
Additional Context?
No response
Product
Hot Chocolate
Version
12.6.0