Skip to content
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

Authorization header not getting pass under API #131

Open
Gautam2010 opened this issue Nov 10, 2020 · 1 comment
Open

Authorization header not getting pass under API #131

Gautam2010 opened this issue Nov 10, 2020 · 1 comment

Comments

@Gautam2010
Copy link

Gautam2010 commented Nov 10, 2020

I have got option to add token as per below image
image

and my yml file looks like this
version: 0.0.1

securityDefinitions:
  bearer:
    type: "apiKey"
    name: "Authorization"
    in: "header"

When I request the API after adding token it doesn't pass token in header.
image

Am I missing any configuration?

I am using version as below

"typescript-rest-swagger": "^1.0.3"

@hoangnguyennn
Copy link

hoangnguyennn commented Feb 22, 2021

@Gautam2010 You have to add @Security to it works

Example:

import { Security } from "typescript-rest";
...

@Security("Admin", "bearer")
getProducts(): string {
  return "OK";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants