Skip to content

Commit 8790af4

Browse files
committed
fix: handle user_code collisions
1 parent bbd3db5 commit 8790af4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

persistence/sql/persister_device.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ func (p *Persister) createDeviceAuthSession(ctx context.Context, deviceCodeSigna
161161

162162
if err = sqlcon.HandleError(p.CreateWithNetwork(ctx, req)); errors.Is(err, sqlcon.ErrConcurrentUpdate) {
163163
return errors.Wrap(fosite.ErrSerializationFailure, err.Error())
164+
} else if errors.Is(err, sqlcon.ErrUniqueViolation) {
165+
return errors.Wrap(fosite.ErrExistingUserCodeSignature, err.Error())
164166
} else if err != nil {
165167
return err
166168
}

0 commit comments

Comments
 (0)