There are a few use cases I have that involve bulk retrieval/removal of tokens in my application. Specifically,
-
When a user removes their account, all tokens for the user should be revoked.
-
When a user no longer wants a connection with a specific app, all tokens for the user and application should be revoked
-
A user should be able to, at any time, view the applications that currently are connected
From my applications perspective, I want to be able to provide a user id from the application in order to get all tokens or revoke all tokens.
Apigee (kinda seems to) support this, as referenced in Get OAuth 2.0 Access Token by End User ID or App ID.
A quick note about my application. Iām using Apigee to expose an API for an existing application. The application is complete and mature. All user management is done in the application, and all data is stored their as well. Apigee, for my application, is really just a pure-proxy with some extra goodies like Application and OAuth management thrown in.
However, the functionality only seems to be enabled via the management API. So hereās my question, if I want to do this, whatās best practice for doing this?
-
Wrap the management API into a proxy that I expose only to my application. The Best Practices for API Proxy Design and Development actually says donāt do this.
āDo not call the Edge management API from inside API proxies. The management API is used for administrative management purposes, not API flow logic. Policies are provided for interaction with API.ā
Is this an example where the best-practice can be broken? On the surface, this seems like my ideal solution.
-
Call the management API from my application directly.
Potential downsides of this. My application is already hitting a few proxies as an EDGE application. Iād have to introduce a secondary authentication mechanism (HTTP Basic) for accessing the Management API, and when the Management API data structures arenāt ideal, Iāll need to have my application handle the details. Basically, some of the benefits of using EDGE as an API Proxy get lost.
-
Skip the management API all together. Upon OAuth token grants, call out to our Application (or BAAS) and store the OAuth token details. Iād also need to do this on OAuth token revokes to keep things synced up. Then have the application retrieve these details directly when needed.
This just feels like more complexity than is really needed, but is technical feasibility.
And my side-question. Why isnāt this just part of the Apigee OAuth2 policies? Am I missing something?