From d2f89fa48351508c2f8518c443dd38ba76ef945f Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Fri, 2 Apr 2021 15:55:32 -0300 Subject: [PATCH] Always cleanup the test callback URL [CLI-116] (#218) * Alwyays cleanup the test callback URL * Add TODO --- internal/cli/utils_shared.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/cli/utils_shared.go b/internal/cli/utils_shared.go index e34a529f0..cdac63a31 100644 --- a/internal/cli/utils_shared.go +++ b/internal/cli/utils_shared.go @@ -156,11 +156,13 @@ func runLoginFlow(cli *cli, t tenant, c *management.Client, connName, audience, // if we added the local callback URL to the client then we need to // remove it when we're done - if callbackAdded { - if err := removeLocalCallbackURLFromClient(cli.api.Client, c); err != nil { - return err + defer func() { + if callbackAdded { + if err := removeLocalCallbackURLFromClient(cli.api.Client, c); err != nil { // TODO: Make it a warning + cli.renderer.Errorf("Unable to remove callback URL '%s' from client: %s", cliLoginTestingCallbackURL, err) + } } - } + }() return nil })