diff options
Diffstat (limited to 'model/client.go')
-rw-r--r-- | model/client.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/model/client.go b/model/client.go index 86e4dccf5..e2e003fe8 100644 --- a/model/client.go +++ b/model/client.go @@ -1557,6 +1557,19 @@ func (c *Client) OAuthDeauthorizeApp(clientId string) *AppError { } } +// RegenerateOAuthAppSecret generates a new OAuth App Client Secret. On success +// it returns an OAuth2 App. Must be authenticated as a user and the same user who +// registered the app or a System Admin. +func (c *Client) RegenerateOAuthAppSecret(clientId string) (*Result, *AppError) { + if r, err := c.DoApiPost("/oauth/"+clientId+"/regen_secret", ""); err != nil { + return nil, err + } else { + defer closeBody(r) + return &Result{r.Header.Get(HEADER_REQUEST_ID), + r.Header.Get(HEADER_ETAG_SERVER), OAuthAppFromJson(r.Body)}, nil + } +} + func (c *Client) GetAccessToken(data url.Values) (*Result, *AppError) { if r, err := c.DoPost("/oauth/access_token", data.Encode(), "application/x-www-form-urlencoded"); err != nil { return nil, err |