Home > Forum > User Voice > UDA: Include complete OAuth2 authentication information in generated/downloaded OpenAPI definition

UDA: Include complete OAuth2 authentication information in generated/downloaded OpenAPI definition
0

Current behavior & Pain point:
The OpenAPI definition generated for a User Defined API only defines Bearer authentication:

type: http
scheme: bearer
bearerFormat: JWT

The individual API operations correctly reference this Bearer security scheme.

However, the OpenAPI definition does not provide any information about how the required access token can be obtained. The generated securitySchemes section contains only Bearer and Cookie authentication.

As a result, after importing the OpenAPI definition into tools such as Postman, Bruno or Yaak, the API endpoints are created correctly, but the OAuth2 authentication required to obtain the Bearer token has to be configured manually.

Proposed solution:
Include the OAuth2 Client Credentials flow in the generated OpenAPI definition, including:

Token endpoint
Client Credentials grant type
Required scope(s)

For example, the imported API client should already know:

Grant Type: Client Credentials
Token URL: https://<server>/api/oauth2/token
Scope: <required WEBCON API scope>
Client ID: [user supplied]
Secret: [user supplied]

Client ID and Client Secret should of course not be exported, as they belong to a specific API application and contain credentials.

This would allow OpenAPI-compatible clients to configure the authentication flow automatically. The developer would only need to provide the Client ID and Client Secret of the WEBCON API application.

Benefit:
The generated OpenAPI definition would describe not only that a Bearer token is required, but also the complete standardized OAuth2 mechanism required to obtain that token.

WEBCON

Since authentication methods are the same for the entire WEBCON REST API, their OpenAPI specification is maintained as a separate document accessible at <your portal URL>/swagger/public/swagger.json (this link is visible at <your portal ULR>/api/index.html) and can be imported once to tools like you mentioned.
Scopes, credentials and authentication flow are situational, thus have to be provided for each case separately.