hard token regen

This commit is contained in:
Hugo Renard 2022-09-23 18:34:45 +02:00
parent b0c763483d
commit 082f3833e8
Signed by: hougo
GPG key ID: 3A285FD470209C59

View file

@ -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) {