Fixed variable names.
This commit is contained in:
@@ -30,9 +30,9 @@ async fn issue_token(
|
||||
client_id,
|
||||
client_secret,
|
||||
} => {
|
||||
let token_hash = Secret::from(client_secret).hash();
|
||||
let client_secret = Secret::from(client_secret).hash();
|
||||
let (true, Some(app)) = (
|
||||
repository::user_app_secrets::verify(&pool, client_id, &token_hash).await?,
|
||||
repository::user_app_secrets::verify(&pool, client_id, &client_secret).await?,
|
||||
repository::user_apps::get_by_id_unscoped(&pool, client_id).await?,
|
||||
) else {
|
||||
return Err(AppError::InvalidClientCredentials);
|
||||
@@ -49,10 +49,10 @@ async fn issue_token(
|
||||
Ok(Json(TokenResponse::new(access_token, None)))
|
||||
}
|
||||
TokenRequest::RefreshToken { refresh_token } => {
|
||||
let token_hash = Secret::from(refresh_token).hash();
|
||||
let refresh_token = Secret::from(refresh_token).hash();
|
||||
let (Some(access_token), Some(refresh_token)) = (
|
||||
repository::access_tokens::get_by_refresh_hash(&pool, &token_hash).await?,
|
||||
repository::refresh_tokens::get_by_hash(&pool, &token_hash).await?,
|
||||
repository::access_tokens::get_by_refresh_hash(&pool, &refresh_token).await?,
|
||||
repository::refresh_tokens::get_by_hash(&pool, &refresh_token).await?,
|
||||
) else {
|
||||
return Err(AppError::InvalidRefreshToken);
|
||||
};
|
||||
@@ -74,12 +74,12 @@ async fn revoke_token(
|
||||
State(pool): State<PgPool>,
|
||||
Form(request): Form<TokenRevocationRequest>,
|
||||
) -> Result<(), AppError> {
|
||||
let token_hash = Secret::from(request.token).hash();
|
||||
let token = Secret::from(request.token).hash();
|
||||
|
||||
repository::access_tokens::delete_by_hash(&pool, &token_hash)
|
||||
repository::access_tokens::delete_by_hash(&pool, &token)
|
||||
.await
|
||||
.ok();
|
||||
repository::refresh_tokens::delete_by_hash(&pool, &token_hash)
|
||||
repository::refresh_tokens::delete_by_hash(&pool, &token)
|
||||
.await
|
||||
.ok();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user