MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / InvalidateAuthorizeCodeSession

Method InvalidateAuthorizeCodeSession

internal/oauth/storage.go:286–296  ·  view source on GitHub ↗

InvalidateAuthorizeCodeSession marks the code consumed via a CAS `WHERE signature = $1 AND active = TRUE`. The CAS is load-bearing: without it, two concurrent token exchanges at READ COMMITTED can each pass GetAuthorizeCodeSession (both see active=TRUE before either UPDATE lands) and both Invalidate

(ctx context.Context, code string)

Source from the content-addressed store, hash-verified

284// ErrInvalidatedAuthorizeCode triggers fosite's deferred rollback in
285// flow_authorize_code_token.go.
286func (s *Storage) InvalidateAuthorizeCodeSession(ctx context.Context, code string) error {
287 tag, err := s.db(ctx).Exec(ctx,
288 `UPDATE oauth_auth_codes SET active = FALSE WHERE signature = $1 AND active = TRUE`, code)
289 if err != nil {
290 return err
291 }
292 if tag.RowsAffected() == 0 {
293 return fosite.ErrInvalidatedAuthorizeCode
294 }
295 return nil
296}
297
298// ───────────────────────── AccessTokenStorage ─────────────────────────
299

Calls 2

dbMethod · 0.95
ExecMethod · 0.65