Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Select JWT Bearer Token from response Header, then use it in request Header #463

Closed
AuroraLantean opened this issue Jan 26, 2025 · 2 comments
Labels
question Further information is requested

Comments

@AuroraLantean
Copy link

AuroraLantean commented Jan 26, 2025

Did you search for existing issues already?
yes
I found those closed issues:

Describe the bug
I can get the the whole authorization header value as Bearer my_token from my Login response header, but to use it, I have to use this syntax

authentication: !bearer "{{chains.auth_token_in_header}}"

, which adds "Bearer " again

Docs:

To Reproduce

chains:
  auth_token_in_header:
    source: !request
      recipe: login
      section: !header Authorization

requests:
  get_authorized_items: !request
    method: GET
    url: "{{host}}/authorized_items"
    authentication: !bearer "{{chains.auth_token_in_header}}"

Expected behavior
the authorization header value should be Bearer my_token

Screenshots
Image

Version (please complete the following information):
OS: Linux Mint 22.1 Xia based on Ubuntu 24.04 noble
Terminal: Zsh
Slumber Version: slumber 2.5.0

Additional context
Add any other context about the problem here.

@AuroraLantean AuroraLantean added the bug Something isn't working label Jan 26, 2025
@LucasPickering
Copy link
Owner

@AuroraLantean You can set the Authorization header directly rather than using the authorization shortcut, to skip the added Bearer prefix.

chains:
  auth_token_in_header:
    source: !request
      recipe: login
      section: !header Authorization

requests:
  get_authorized_items: !request
    method: GET
    url: "{{host}}/authorized_items"
    headers:
      Authorization: "{{chains.auth_token_in_header}}"

@LucasPickering LucasPickering added question Further information is requested and removed bug Something isn't working labels Jan 27, 2025
@AuroraLantean
Copy link
Author

It works. Thank you 👍 💯 :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants