ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
137 stars 60 forks source link

Relative paths provided for Oauth2 `tokenUrl`, `refreshUrl`, or `authorizationUrl` not properly set in the generated Oauth2 grant types #6369

Open ayeshLK opened 5 months ago

ayeshLK commented 5 months ago

Description:

$subject

According to the OpenAPI specification documentation [1] developers can define Oauth2 tokenUrl, refreshUrl, or authorizationUrl as relative paths for the API base URL in the security schemas if authz endpoints are located in the same server. But, when try define these in the OpenAPI spec and try to generate the client code using that the generated types only contain the relative path.

Consider the following generated code:

public type OAuth2ClientCredentialsGrantConfig record {|
    *http:OAuth2ClientCredentialsGrantConfig;
    # Token URL
    string tokenUrl = "/oauth/token";
    ...
|};

[1] - https://swagger.io/docs/specification/authentication/oauth2/ refer Relative Endpoint URLs section.

dilanSachi commented 5 months ago

This is a known issue and fixed in the latest version

Ref - https://github.com/ballerina-platform/ballerina-library/issues/4877