API gateway to the rescue
Background
There is an authorization service implementing a token endpoint to issue API access tokens to registered clients with valid client credentials. The implementation is inspired by OAuth 2.0 Client Credentials Grant in spirit but not in letter. The areas of difference is listed below:
Any client - be it first party or third party - which implements standard OAuth 2.0 Client Credentals Grant type for getting tokens will NOT be able to consume the token endpoint in an OOTB fashion and will require some form of custom logic to consume the endpoint.
Note: This is not an imaginary problem but something encountered by the author at a certain organization.
Problem Statement
Options
This proxy does the required translation to provide an OAuth 2.0 Client Credetials Grant type compliant endpoint for API consumers. Any new API consumers which require a compliant endpoint for tokens make use of this new endpoint exposed on API gateway.
Recommendation
Chose Option 2 because it achieves the goal of OAuth 2.0 Client Credentials Grant type compliant token endpoint without requiring any change to API consumers, existing token endpoint and its existing consumers.
The proxy exposes a single endpoint for tokens and is stateless.
The only effort required is to create an APIGW proxy configuration and deploy it using the exiting CICD pipeline.
Note: The organization had an APIGW deployed and along with a well-defined CICD mechanism.
Positive Consequences
Negative Consequences
Architecture
Fig. 1 High-level architecture
Fig.2 Sequence diagram
In Conclusion
API gateways are commonly used for security, traffic management, and header/url/payload transformations. One usecase where the API gateway can be leveraged is to expose endpoints compliant with standards without affecting existing endpoints which are non-compliant but in active use. The standards could be industry standards like OAuth 2.0 or (internal) company standards for API design.