diff --git a/pkg/supplier/rocketchat.go b/pkg/supplier/rocketchat.go index 388a54a..7b1f73f 100644 --- a/pkg/supplier/rocketchat.go +++ b/pkg/supplier/rocketchat.go @@ -251,14 +251,14 @@ func (rc *rocketchat) accessTokenExists() (bool, error) { func (rc *rocketchat) regenerateAccessToken() (string, error) { body := map[string]string{"tokenName": "scim"} - resp, err := rc.R().SetBody(body).Post("/api/v1/users.regeneratePersonalAccessToken") + resp, err := rc.R().SetBody(body).Post("/api/v1/users.removePersonalAccessToken") if err != nil { return "", err } if resp.IsError() { - return "", fmt.Errorf("failed to regenerate access token - %s", resp.Body()) + return "", fmt.Errorf("failed to remove access token - %s", resp.Body()) } - return gjson.Get(string(resp.Body()), "token").String(), nil + return rc.generateAccessToken() } func (rc *rocketchat) generateAccessToken() (string, error) {