diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-09-16 16:26:56 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-09-16 16:26:56 -0400 |
commit | b1f26540ce29cf4ff403cc7b65b20c891ca64118 (patch) | |
tree | fd7a83ebb963dc5f0208dc4dba00aa2f730a364e /web/react/utils | |
parent | 4e11fa23d750afbefad099638530b754776a3357 (diff) | |
parent | 47e6a33a4505e13ba4edf37ff1f8fbdadb279ee3 (diff) | |
download | chat-b1f26540ce29cf4ff403cc7b65b20c891ca64118.tar.gz chat-b1f26540ce29cf4ff403cc7b65b20c891ca64118.tar.bz2 chat-b1f26540ce29cf4ff403cc7b65b20c891ca64118.zip |
Merge pull request #693 from mattermost/mm-1419
Implement OAuth2 service provider functionality.
Diffstat (limited to 'web/react/utils')
-rw-r--r-- | web/react/utils/client.jsx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 902eb1642..ba3042d78 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -987,3 +987,36 @@ export function updateValetFeature(data, success, error) { track('api', 'api_teams_update_valet_feature'); } + +export function registerOAuthApp(app, success, error) { + $.ajax({ + url: '/api/v1/oauth/register', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify(app), + success: success, + error: (xhr, status, err) => { + const e = handleError('registerApp', xhr, status, err); + error(e); + } + }); + + module.exports.track('api', 'api_apps_register'); +} + +export function allowOAuth2(responseType, clientId, redirectUri, state, scope, success, error) { + $.ajax({ + url: '/api/v1/oauth/allow?response_type=' + responseType + '&client_id=' + clientId + '&redirect_uri=' + redirectUri + '&scope=' + scope + '&state=' + state, + dataType: 'json', + contentType: 'application/json', + type: 'GET', + success: success, + error: (xhr, status, err) => { + const e = handleError('allowOAuth2', xhr, status, err); + error(e); + } + }); + + module.exports.track('api', 'api_users_allow_oauth2'); +} |