Ensure we dont return already claimed token again (#3420)
This commit is contained in:
parent
bfa6699e2c
commit
44dc2c8c69
@ -47,9 +47,12 @@ func (service *Service) GetOrCreate(ctx context.Context, userID string) (_ *Toke
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existingGroup != nil && len(existingGroup) > 0 {
|
if existingGroup != nil && len(existingGroup) > 0 {
|
||||||
authorization := existingGroup[0]
|
for _, authorization := range existingGroup {
|
||||||
|
if authorization.Claim == nil {
|
||||||
return &authorization.Token, nil
|
return &authorization.Token, nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
createdGroup, err := service.db.Create(ctx, userID, 1)
|
createdGroup, err := service.db.Create(ctx, userID, 1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user