From 79702874a1c717d02ecb6e61ba987f9b14853d12 Mon Sep 17 00:00:00 2001 From: Nikos Date: Wed, 8 Jan 2025 16:28:39 +0100 Subject: [PATCH] fix: handle user_code collisions --- persistence/sql/persister_device.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/persistence/sql/persister_device.go b/persistence/sql/persister_device.go index 50675646b4..c6663236cb 100644 --- a/persistence/sql/persister_device.go +++ b/persistence/sql/persister_device.go @@ -161,6 +161,8 @@ func (p *Persister) createDeviceAuthSession(ctx context.Context, deviceCodeSigna if err = sqlcon.HandleError(p.CreateWithNetwork(ctx, req)); errors.Is(err, sqlcon.ErrConcurrentUpdate) { return errors.Wrap(fosite.ErrSerializationFailure, err.Error()) + } else if errors.Is(err, sqlcon.ErrUniqueViolation) { + return errors.Wrap(fosite.ErrExistingUserCodeSignature, err.Error()) } else if err != nil { return err }