Description
In OpenAPI 2.0, authorizationUrl sends users to sign in and grant consent for the accessCode and implicit flows.
Potential impact
A wrong host or path can break sign-in or send users to the wrong site to enter credentials.
Remediation
Set authorizationUrl in securityDefinitions to the provider’s published HTTPS authorization endpoint. Verify the host and path. The URL must have no fragment (# and the text that follows).
Examples
For a new integration, use accessCode with PKCE in the client and authorization server. Set tokenUrl to the same provider’s token endpoint.
Before
yaml
swagger: "2.0"
securityDefinitions:
petstore_auth:
type: oauth2
flow: accessCode
authorizationUrl: https://api.invalid.comp@#any.com/oauth/authorize
tokenUrl: https://api.my.company.com/oauth/token
scopes:
read:pets: read pets
After
yaml
swagger: "2.0"
securityDefinitions:
petstore_auth:
type: oauth2
flow: accessCode
authorizationUrl: https://api.my.company.com/oauth/authorize
tokenUrl: https://api.my.company.com/oauth/token
scopes:
read:pets: read pets