oav icon indicating copy to clipboard operation
oav copied to clipboard

UNRESOLVABLE_REFERENCE when adding security definitions for AAD Token auth in Swagger 2.0

Open joseharriaga opened this issue 3 years ago • 0 comments

I’m looking at the AutoRest authentication documentation on GitHub, where it says that I can declare that my REST API uses AAD Token authentication in Swagger 2.0 like this:

{
  "securityDefinitions": {
    "AADToken": {
      "type": "oauth2",
      "flow": "accessCode",
      "authorizationUrl": "https://login.microsoftonline.com/common/v2.0/oauth2/authorize",
      "tokenUrl": "https://login.microsoftonline.com/common/v2.0/oauth2/token"
    }
  },
  "security": [
    {
      "AADToken": ["https://myservice.azure.com/.default"]
    }
  ]
}

I added this to my swagger spec and replaced "https://myservice.azure.com/.default" accordingly. When I create a PR to commit my swagger spec into the azure-rest-api-specs repo, CI validation fails during the semantic validation check with an UNRESOLVABLE_REFERENCE error and a message saying "Security scope definition could not be resolved" and pointing to the AADToken URL that I replaced above. I contacted the AutoRest team and they suggested that this appears to be an issue with OAV.

joseharriaga avatar Dec 17 '21 17:12 joseharriaga