Azure / Azure/oav

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

Open
#723 0 comments 0 reactions 1 assignee Claimed by @raych1 View on GitHub
Dominant language
TypeScript
Stars
104
Forks
62
Avg merge
2d 12h
Merged PRs (30d)
5

Description

I’m looking at the [AutoRest authentication documentation on GitHub](https://github.com/Azure/autorest/blob/main/docs/generate/authentication.md), where it says that I can declare that my REST API uses AAD Token authentication in Swagger 2.0 like this:

```json
{
"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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.