Description
OpenAPI 2.0 flow: implicit returns the access token directly in the redirect response.
Potential impact
A leaked token can be reused. Accepting the wrong token can also associate a client session with the wrong account.
Remediation
Move the client and authorization server to the authorization code flow with PKCE. Set flow: accessCode in securityDefinitions and supply the provider’s HTTPS authorizationUrl and tokenUrl.
Examples
The authorization server verifies PKCE when the client exchanges its code for a token.
Before
json
{
"securityDefinitions": {
"oauth2": {
"type": "oauth2",
"flow": "implicit",
"authorizationUrl": "https://api.example.com/oauth/authorize",
"scopes": {}
}
}
}
After
json
{
"securityDefinitions": {
"oauth2": {
"type": "oauth2",
"flow": "accessCode",
"authorizationUrl": "https://api.example.com/oauth/authorize",
"tokenUrl": "https://api.example.com/oauth/token",
"scopes": {}
}
}
}