My Controller(AccountController) have a Action(Login) For Authentication and This Is My Program.Cs (I'm Using ASP.NET Core 8.0) :
//...
services.AddSwaggerGen(option =>
{
option.AddSecurityDefinition("OAuth2", new OpenApiSecurityScheme
{
Type = SecuritySchemeType.OAuth2,
Flows = new OpenApiOAuthFlows
{
Password = new OpenApiOAuthFlow
{
TokenUrl = new Uri($"{siteUrl}/v1/AccountController/Login")
}
}
});
option.OperationFilter<UnauthorizedResponsesOperationFilter>(true, "OAuth2");
};
//...
everything is Okey If "https://WebApplication/AccountController/Login" Return Json Like This :
{
"access_token":"2YotnFZFEjr1zCWpAA",
"token_type":"bearer"
}
But My Proje Is Big... and My Action Should Return This :
{
"data": {
"access_token": "mh-1ea5_ssqrL9g",
"refresh_token": "792bdbd30145260c",
"token_type": "Bearer",
"expires_in": 1999
},
"isSuccess": true,
"statusCode": "success",
"message": "Login Was Success"
}
Once logged(Left Image), the API EndPoints show the locked padlock but when I try to use them, I see the call is done without the returned bearer: : Bearer undefined(Right Image)