diff --git a/client/client.go b/client/client.go index c4f8d6e..1b24931 100644 --- a/client/client.go +++ b/client/client.go @@ -67,6 +67,8 @@ func NewClient(authorizationStateHandler AuthorizationStateHandler, options ...O err := Authorize(client, authorizationStateHandler) if err != nil { + client.Stop() + return nil, err } @@ -143,3 +145,8 @@ func (client *Client) GetListener() *Listener { return listener } + +func (client *Client) Stop() { + client.Destroy() + client.jsonClient.Destroy() +}