Forum Discussion

poponuts1's avatar
poponuts1
New Member
2 years ago

securityDefinition / securitySchema for bearer tokens doesn't work

So, I converted my AWS APIGateways into a swagger json file. This is how it looks like:

"securityDefinitions" : {
"TokenAuthoriser" : {
"type" : "apiKey",
"name" : "Authorization",
"in" : "header",

"x-amazon-apigateway-authtype" : "custom",
"x-amazon-apigateway-authorizer" : {
"authorizerUri" : "arn:aws:apigateway:ap-southeast-1:lambda:path/2015-03-31/functions/arn:aws:lambda:ap-southeast-1:423790761911:function:authorisation-authorisers-dev-authoriseToken/invocations",
"authorizerResultTtlInSeconds" : 300,
"identityValidationExpression" : "^[Bb]earer [-0-9a-zA-z\\.]*$",
"type" : "token"
}
}
 
 
However, I wanted to change this to a bearer token since it doesn't work with apiKeys.
When I changed it to:
"securityDefinitions": {
"TokenAuthoriser": {
"type": "http",
"scheme": "bearer"
}
}
 

I get the error:

Structural error at securityDefinitions.TokenAuthoriser.type

should be equal to one of the allowed values allowedValues: basic, apiKey, oauth2
 
I can't find any documentation that explicitly points to this issue. I looked up:
https://swagger.io/docs/specification/authentication/bearer-authentication/
 
and changing securityDefinitions to securitySchemes doesn't display the "Authorize" button on the Swagger.
 
No RepliesBe the first to reply