fix: Check for existing device when creating oauth session

This commit is contained in:
Ginger committed 2026-06-29 09:35:51 -04:00
1 parent c56c035c15
commit 761a6a53d0
1 file changed
+14
+14
View File
@@ -350,6 +350,20 @@ impl Service {
})
.ok_or_else(|| OAuthError::invalid_grant("No device ID scope supplied"))?;
if self
.services
.users
.get_device_metadata(&authorizing_user, device_id)
.await
.is_ok()
{
return Err(OAuthError {
error: ErrorCode::InvalidScope,
error_description: "A device with the supplied ID already exists for this user"
.into(),
});
}
self.services
.users
.create_device(