Using nswag Studio - Security or Autharization calss is not getting created. #5015
Unanswered
ivinsyriac
asked this question in
Q&A
Replies: 1 comment
-
the swagger document json that is pulled down does not include oAuth security information. the http client initialization is external to the wrapper that NSwag Studio is generating for you. In order to add OAuth Security headers to the client request, you will need to create or find a OAuth Delegating Handler that you can initialize your HttpClient with in the HttpClientFactory handler pipeline. That can take your credentials and query the identity server you are using and then attach the bearer and UserJwt header tokens to the request. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, Thanks for the great tool. Iam facing a problem in Nswag studio.
On supplying Open API/swagger specification or Json schema to the NSWAG studio for generating C# controller/client, Authorization related Security SecurityDefinitions/SecurityScheme classes are not getting created.
Below is the swagger 2.0 json. I can see Authorize button in the swagger UI with the below definitions. Unfortunately on generating client/controller with NSwag Studiov14.1.0.0, Generated Class doesnt have the Authorization header definitions.
"securityDefinitions": {
"Oauth2": {
"type": "oauth2",
"tokenUrl": "http://localhost:444/some/auth",
"description": "Oauth"
}
},
"security": [
{
"Oauth2": [ ]
}
]
Can someone help on this topic.
Is there any kind of restriction for Security tag or Authorization in Nswag studio (on Generating C# client)?
Is there any other ways to get this done in Nswag studio.
Beta Was this translation helpful? Give feedback.
All reactions