diff --git a/backend/src/db.rs b/backend/src/db.rs index fe887b0f..fa31b4a1 100644 --- a/backend/src/db.rs +++ b/backend/src/db.rs @@ -497,7 +497,7 @@ mod tests { s!("username2"), s!("token2"), s!("expiration_date2"), - s!("https://foo.bar"), + s!("https://foo.bar/2"), ) .await .unwrap(); diff --git a/backend/src/handlers_prelude/oauth.rs b/backend/src/handlers_prelude/oauth.rs index 1f7d4a40..22bfeaae 100644 --- a/backend/src/handlers_prelude/oauth.rs +++ b/backend/src/handlers_prelude/oauth.rs @@ -116,7 +116,7 @@ async fn get_oath_processor( .expires_in() .wrap_err("Discord OAuth2 response didn't include an expiration date")?; // Update the user entry if one is already there, otherwise create a user - if let Some(existing_user) = all_users.iter().find(|u| u.token == *token) { + if let Some(existing_user) = all_users.iter().find(|u| u.username == discord_user_info.username) { state .db .update_user(&User {