Bearer authorization does not work #2

Closed
opened 2020-02-27 10:29:31 +00:00 by Ghost · 6 comments

Using bearer authorization as described in the readme fails to set the correct header. Adding the header manually through opts.headers works fine.

Looking at the code there are at least a couple of bugs:

  1. The bearer token is read from opts.bearer, not opts.auth.bearer as described.

  2. The header value includes a colon after "Bearer", this should not be there.

Using bearer authorization as described in the readme fails to set the correct header. Adding the header manually through opts.headers works fine. Looking at the code there are at least a couple of bugs: 1. The bearer token is read from opts.bearer, not opts.auth.bearer as described. 2. The header value includes a colon after "Bearer", this should not be there.
Owner

Good catch. Would you like to fork and give me a PR link?

Good catch. Would you like to fork and give me a PR link?
Author

Sorry, not comfortable sending a change when there are zero tests to help keep me from breaking things.

Sorry, not comfortable sending a change when there are zero tests to help keep me from breaking things.
Owner

Are you just being self-righteous or are you serious?

I'm assuming that you must have a test case being that you came to this issue with the exact solution... and you're telling me that you're not comfortable removing the single character : and adding the missing sub-object?

Are you just being self-righteous or are you serious? I'm assuming that you must have a test case being that you came to this issue with the exact solution... and you're telling me that you're not comfortable removing the single character `:` and adding the missing sub-object?
Author

I have an easy way to test a released version, but I haven't even cloned the repo, never mind figuring out how to build and test locally. Sorry. Feel free to ignore the report if you like.

I have an easy way to test a released version, but I haven't even cloned the repo, never mind figuring out how to build and test locally. Sorry. Feel free to ignore the report if you like.
Owner

There is no build. It's a single file.

That said, I can make the change myself... I just haven't noticed or needed it because I use opts.headers for simple things like Bearer tokens.

I only kept the complex / silly options for the sake of compatibility.

There is no build. It's a single file. That said, I can make the change myself... I just haven't noticed or needed it because I use `opts.headers` for simple things like `Bearer` tokens. I only kept the complex / silly options for the sake of compatibility.
Owner

Fixed in v1.5.0

Fixed in v1.5.0
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: root/request.js#2
No description provided.