Skip to content

Commit 662f199

Browse files
committed
Mark access token as used when calling the userinfo endpoint
1 parent 177a0f4 commit 662f199

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

crates/axum-utils/src/user_authorization.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ impl<F: Send> UserAuthorization<F> {
117117
return Err(AuthorizationVerificationError::InvalidToken);
118118
}
119119

120+
if !token.is_used() {
121+
// Mark the token as used
122+
repo.oauth2_access_token().mark_used(clock, token).await?;
123+
}
124+
120125
Ok(session)
121126
}
122127
}

crates/handlers/src/oauth2/userinfo.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ pub async fn get(
142142
.await?
143143
.ok_or(RouteError::NoSuchClient)?;
144144

145+
repo.save().await?;
146+
145147
if let Some(alg) = client.userinfo_signed_response_alg {
146148
let key = key_store
147149
.signing_key_for_algorithm(&alg)

0 commit comments

Comments
 (0)