From 7ee36fa211bb86345956ba4820ab109d81be0166 Mon Sep 17 00:00:00 2001 From: Ian2020 Date: Wed, 26 May 2021 11:07:32 +0100 Subject: [PATCH] Do not delete non-existant client secret for PKCE clients --- pkg/db/db.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/db/db.go b/pkg/db/db.go index 31dc287..7a8cf40 100644 --- a/pkg/db/db.go +++ b/pkg/db/db.go @@ -245,10 +245,13 @@ func (store *CredentialStore) DeleteClient(clientName string) (bool, error) { return false, errors.New("the client does not exist") } - _, keyringErr := store.DeleteClientSecret(clientName) + // PKCE clients don't have secrets, so skip this step if there's no secret. + if clients[clientName].GrantType != oidc.PKCE { + _, keyringErr := store.DeleteClientSecret(clientName) - if keyringErr != nil { - return false, keyringErr + if keyringErr != nil { + return false, keyringErr + } } tokenErr := store.DeleteTokens(clientName)