XeroAPI / xoauth

A CLI tool for obtaining JWTs from OpenId Connect providers
MIT License
49 stars 16 forks source link

Deleting client gives: panic: secret not found in keyring #22

Open berenddeboer opened 3 years ago

berenddeboer commented 3 years ago

When I try to delete a client I get:

./xoauth delete dummy
? Are you sure you want to delete this connection? Yes
panic: secret not found in keyring

goroutine 1 [running]:
github.com/XeroAPI/xoauth/pkg/config.ConfirmDelete(0xc0000cb100, 0x7fffaed9815d, 0x5)
        /home/runner/work/xoauth/xoauth/pkg/config/delete.go:30 +0x286
github.com/XeroAPI/xoauth/cmd.init.0.func6(0xc0000f1340, 0xc0000cb0a0, 0x1, 0x1)
        /home/runner/work/xoauth/xoauth/cmd/root.go:127 +0x52
github.com/spf13/cobra.(*Command).execute(0xc0000f1340, 0xc0000cb080, 0x1, 0x1, 0xc0000f1340, 0xc0000cb080)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xd1f720, 0x0, 0x8815a0, 0xc000098058)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
github.com/XeroAPI/xoauth/cmd.Execute(...)
        /home/runner/work/xoauth/xoauth/cmd/root.go:254
main.main()
        /home/runner/work/xoauth/xoauth/xoauth.go:13 +0x47
nikhilfsoft commented 3 years ago

Same issue here. Is there any solution to this?

Ian2020 commented 3 years ago

This happened for me with a PKCE client as the code tries to delete a client secret that's not there (PKCE clients don't need one). If that's your use-case and you can't wait for the fix you can workaround it in the short-term by very carefully (backup first!):

I've submitted a PR to fix it.