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

Add Bearer Authentication to Swagger Documentation #80

Open
kazimovzaman2 opened this issue Feb 11, 2024 · 2 comments
Open

Add Bearer Authentication to Swagger Documentation #80

kazimovzaman2 opened this issue Feb 11, 2024 · 2 comments
Labels
🤔 Question Further information is requested

Comments

@kazimovzaman2
Copy link

I need guidance on how to implement Bearer Authentication in the Swagger documentation for our Fiber middleware. Specifically, I'm unsure about what values to provide for the PreauthorizeApiKey field in the Swagger configuration. Any assistance on how to correctly configure this for Bearer Authentication would be greatly appreciated.

app.Get("/swagger/*", swagger.New(swagger.Config{
	PreauthorizeApiKey: "Bearer",
}))
@ReneWerner87 ReneWerner87 added the 🤔 Question Further information is requested label Feb 11, 2024
@BrianIto
Copy link

//main.go

//      @Title "Your API Name"
//	@SecurityDefinitions.apikey	Bearer

This works fine for OAS 2.0.

On your code, you should name which routes (by placing it before the functions) should have this security param.

using

@Security     Bearer

@xl495
Copy link

xl495 commented Oct 12, 2024

//main.go

//      @Title "Your API Name"
//	@SecurityDefinitions.apikey	Bearer

This works fine for OAS 2.0.

On your code, you should name which routes (by placing it before the functions) should have this security param.

using

@Security     Bearer

But it seems like this method doesn't work for adding the token in the format Bearer xxx, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 Question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants