DEV Community

bestbee
bestbee

Posted on

Shared Token or Per-User OAuth for AI Agents? Use This Gate

A support agent needs to read tickets and occasionally apply a label. One team can give the application a service credential. Another can delegate the signed-in operator’s permissions. Removing a departing operator exposes the practical difference: which actions can still run, and under whose authority?

Start with one row per action, even if the same integration implements several. “Search tickets” might expose confidential records. “Write label” might trigger an external workflow. Read/write alone does not establish the impact.

Question What to put in the decision record
Who is allowed to request the action? A user, a scheduled workload, or both, and who verifies that fact
What identity does the target enforce? End user, workload instance, or a service shared by all callers
How much can that identity reach? Resources and operations, including tenant boundaries
How is access removed? Owner, grant or key to revoke, and how outstanding work behaves
What evidence survives? A request identifier linking the initiating principal and downstream outcome

For a nightly export, a narrowly scoped workload identity may be a better fit than borrowing one employee’s grant. For a user-triggered label change that must obey the user’s ticket permissions, delegated access is a natural choice if the target enforces those permissions. A shared credential can still be appropriate when the service itself is the authorized principal and an upstream service independently authenticates and authorizes every request. It cannot, by itself, tell the target who clicked a button.

Test revocation where the action happens

In a test tenant, revoke a test grant using the supported control. Record when the control acknowledges it and when the target first refuses a previously permitted harmless request. Include a queued request that was accepted by the application before revocation. Test refresh and access tokens independently where applicable. An audit-log subject proves attribution only if you can tie it to the actual authorization decision.

OAuth token revocation permits propagation delay, and the treatment of related tokens depends on token type and server policy. Document the observed behavior of the specific provider. Repeat the check when scopes, caching, job duration or offboarding change. RFC 7009.

This article was created with AI assistance.

Top comments (0)