-
Notifications
You must be signed in to change notification settings - Fork 67
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
Support For Authorization Headers #3
Comments
@adamsanderson Sounds great! I think it makes most sense to put it in |
Sounds good. I'll give it a shot this evening. |
Kind of embarrassing, but I'm stuck... I'm pretty sure the change just boils down to adding this near where the body is being set:
I wanted to test that with the example app, but following the directions on the readme leaves me with a build error when I run
Any suggestions? Sorry if this is a bit remedial, but wrangling webpack and npm doesn't appear to be my strong suit. |
@adamsanderson No worries! Did you run |
@ryanashcraft that explains everything! I was able to get it running at one point, but changes weren't being reflected. Now I realize that I did try building it. Ok, I think I'm unblocked, I'll try that out tonight. |
Is there a workaround until this PR lands? |
I don't think so, nothing outside of the middleware has a chance to touch the superagent request. |
Ahh. That's too bad. |
Resolved by #10. Will go out as part of 1.1.0 but in meantime is available by installing |
Sorry but it's still not clear for me how I can automatically inject the authorization header (jwt) in all ongoing requests through a middleware. Any idea? |
chore: update dist
Is there a way to set headers requests?
It's common to use a header like
Authorization: bearer random-token
for authenticating against a restful API. I saw that there's anoptions
hash that can be passed along to the middleware, but those only seem to be used for the HTTP method.If the middleware supported a headers option, or something similar, you could intercept
REQUEST_ASYNC
actions with an authorization middleware before it hitmiddleware/query.js
and merge in any headers your application needs.Is that a reasonable direction for a pull request? Is there a better solution?
The text was updated successfully, but these errors were encountered: