© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
C
C#
•
2y ago
•
8 replies
SirCypkowskyy
Bearer token is not used by Swagger for endpoints with [authorize], but used for [AllowAnonymous]
Hey
!
Yesterday while working on a project for university I encountered a strange bug
, which can be seen in the screens below
:
- When an endpoint is marked with the
[Authorize]
[Authorize]
attribute
, even if a Bearer Token is specified in Swagger
, this Token will not be used in the execution of the request
.
- If we use the
[AllowAnonymous]
[AllowAnonymous]
attribute instead of
[Authorize]
[Authorize]
, the Bearer Token will be sent in the request
.
The described behaviour can be seen in the screenshots
. Does anyone know what might be generating it
? And how can I fix it
?
C#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
Implementing auth0 with .NET Swagger bearer token authorize seems to be working, but not tables
C
C# / help
2y ago
Scalar with Bearer Token
C
C# / help
12mo ago
[AllowAnonymous] not working when request was handled by YARP
C
C# / help
2y ago
❔ SingalR Hub Bearer Token Auth
C
C# / help
3y ago