You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for providing such a great tool for generating API client and server code from Go interfaces!
However, it currently lacks a way to define authentication methods (such as API keys, JWT, or OAuth2) directly within the Oto interface definitions.
In OpenAPI, we can specify security schemes (e.g., http, oauth2, apiKey) to define authentication requirements for different endpoints. It would be very helpful if Oto provided a similar mechanism to declare authentication requirements, so that authentication could be automatically enforced or documented in the generated code.
Proposed Solution
Introduce a way to define authentication within the Oto interface, similar to OpenAPI security schemes.
Possible approaches:
Add a struct tag (e.g., @auth:"bearer" for authentication).
Define authentication at the service level using a special interface or annotation.
Generate authentication middleware automatically in the output code.
Description
Thank you for providing such a great tool for generating API client and server code from Go interfaces!
However, it currently lacks a way to define authentication methods (such as API keys, JWT, or OAuth2) directly within the Oto interface definitions.
In OpenAPI, we can specify security schemes (e.g.,
http
,oauth2
,apiKey
) to define authentication requirements for different endpoints. It would be very helpful if Oto provided a similar mechanism to declare authentication requirements, so that authentication could be automatically enforced or documented in the generated code.Proposed Solution
@auth:"bearer"
for authentication).Example
A possible Oto-style interface might look like:
This would indicate that SecureMethod requires authentication via a Bearer token.
Benefits
Would love to hear thoughts from the maintainers and community on whether this would be a useful addition!
Thank you!
The text was updated successfully, but these errors were encountered: