Skip to content

Using CredentialsMethod.ApiToken adds Authorization header which is not allowed according to Configuration #146

@vstenvik

Description

@vstenvik

After updating from 0.5.1 to 0.8.0 I started getting the following error message:

Header 'Authorization' is a reserved HTTP header and should not be set via custom headers. Setting this header may cause authentication failures, request corruption, or other unexpected behavior. Reserved headers include: Authorization, Content-Type, Content-Length, Host, Accept, Accept-Encoding, Transfer-Encoding, Connection, Cookie, Set-Cookie, Date. (Parameter 'DefaultHeaders')

After some digging I see that the when using ApiToken the Authorization header is set on DefaultHeaders here:

_configuration.DefaultHeaders["Authorization"] =

and then when creating a new api client it validates that the Authorization header is not in DefaultHeaders here:

if (ReservedHeaders.Contains(header.Key)) {

This causes the application to crash. This seems contradicting to me, or am I missing something?

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

Status

In review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions