diff options
author | enahum <nahumhbl@gmail.com> | 2016-08-30 21:15:40 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-30 21:15:40 -0300 |
commit | 1326ab66a141e73f1ef7d9d39bb86596f56179e0 (patch) | |
tree | b77723b70bdcfc2bca2ab47580d86eb54a61cd44 /model | |
parent | e9bc77a8f7f07cb08038e007c52a986cf4b9545b (diff) | |
download | chat-1326ab66a141e73f1ef7d9d39bb86596f56179e0.tar.gz chat-1326ab66a141e73f1ef7d9d39bb86596f56179e0.tar.bz2 chat-1326ab66a141e73f1ef7d9d39bb86596f56179e0.zip |
PLT-3984 Add the ability to regenerate OAuth Client Secret (#3899)
Diffstat (limited to 'model')
-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 |