From daa26bf726490de87f98b6a0ed13c6f45555f5c9 Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 16 Nov 2025 15:25:22 +0100 Subject: [PATCH] OAuth: fix duplicate devices --- plugin/auth/oauth.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/auth/oauth.go b/plugin/auth/oauth.go index b805e4884..f4525ff4c 100644 --- a/plugin/auth/oauth.go +++ b/plugin/auth/oauth.go @@ -106,7 +106,7 @@ func NewOauth(ctx context.Context, name, device string, oc *oauth2.Config, opts // reuse instance if instance := getInstance(subject); instance != nil { - if device != "" { + if device != "" && !slices.Contains(instance.devices, device) { instance.devices = append(instance.devices, device) } return instance, nil @@ -126,14 +126,14 @@ func NewOauth(ctx context.Context, name, device string, oc *oauth2.Config, opts name: name, } - if device != "" && !slices.Contains(o.devices, device) { - o.devices = append(o.devices, device) - } - for _, opt := range opts { opt(o) } + if device != "" { + o.devices = []string{device} + } + // load token from db var token oauth2.Token if settings.Exists(o.subject) {