From fd0fd54aab5de6069cdeb33eb024caabb8afc890 Mon Sep 17 00:00:00 2001 From: Ginger Date: Wed, 2 Dec 2026 22:58:05 -0500 Subject: [PATCH] feat: Return a specific error when trying to revoke a static access token --- src/service/oauth/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/service/oauth/mod.rs b/src/service/oauth/mod.rs index 6bea19c40..047cdb5c2 100644 --- a/src/service/oauth/mod.rs +++ b/src/service/oauth/mod.rs @@ -614,8 +614,12 @@ impl Service { self.services.users.find_from_token(&token).await { (user_id, device_id) + } else if self.get_client_credentials_session(&token).is_some() { + return Err(OAuthError::invalid_grant( + "Access tokens for static clients cannot be revoked.", + )); } else { - return Err(OAuthError::invalid_grant("Invalid access or refresh token")); + return Err(OAuthError::invalid_grant("Invalid access or refresh token.")); }; // This will also call [`Self::remove_session`]