Mastering Development

How to set a Jwt Token generated to the Authorization header (bearer) on login (gateway-express)

I want to set a generated Jwt token to the header of my requests in order to access resources when authenticated using gateway-express : the token is generated with a script and veryfied using the secretOrPublicKey property of the jwt policy.
I want to access through the path i specified my resource without going through setting the token manually (in Postman for example) i tried something like the following (under policies in the gateway.config.yml file):

 - request-transformer:
        - action:
                Authorization: "'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2ZzZ4QlIyOUJKZjZqRG43cHNvUVVRIiwibmFtZSI6Ikl0ZXMgUyIsImlhdCI6MTUzODgyODcwNn0.bUB4VlJGUNpJrJymNGXT3gKvXRM09oXH_FJ6IaBU88s'"

But it doesn’t give me access when i log in with credentials through the login page.

Thanks for the help

Leave a Reply

Your email address will not be published. Required fields are marked *