diff options
author | Wim <wim@42.be> | 2017-07-16 14:29:46 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2017-07-16 14:29:46 +0200 |
commit | aec5e3d77b6e480d04dd8773723de62416a94919 (patch) | |
tree | 57ab269e6c46e62e61db04a9ca6fbb55e736519f /vendor/github.com/nlopes/slack/oauth.go | |
parent | 335ddf8db543bf64522196e6928c3d10af64694c (diff) | |
download | matterbridge-msglm-aec5e3d77b6e480d04dd8773723de62416a94919.tar.gz matterbridge-msglm-aec5e3d77b6e480d04dd8773723de62416a94919.tar.bz2 matterbridge-msglm-aec5e3d77b6e480d04dd8773723de62416a94919.zip |
Update vendor (nlopes/slack)
Diffstat (limited to 'vendor/github.com/nlopes/slack/oauth.go')
-rw-r--r-- | vendor/github.com/nlopes/slack/oauth.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/vendor/github.com/nlopes/slack/oauth.go b/vendor/github.com/nlopes/slack/oauth.go index 1285abbd..db10aa1b 100644 --- a/vendor/github.com/nlopes/slack/oauth.go +++ b/vendor/github.com/nlopes/slack/oauth.go @@ -1,6 +1,7 @@ package slack import ( + "context" "errors" "net/url" ) @@ -30,7 +31,12 @@ type OAuthResponse struct { // GetOAuthToken retrieves an AccessToken func GetOAuthToken(clientID, clientSecret, code, redirectURI string, debug bool) (accessToken string, scope string, err error) { - response, err := GetOAuthResponse(clientID, clientSecret, code, redirectURI, debug) + return GetOAuthTokenContext(context.Background(), clientID, clientSecret, code, redirectURI, debug) +} + +// GetOAuthTokenContext retrieves an AccessToken with a custom context +func GetOAuthTokenContext(ctx context.Context, clientID, clientSecret, code, redirectURI string, debug bool) (accessToken string, scope string, err error) { + response, err := GetOAuthResponseContext(ctx, clientID, clientSecret, code, redirectURI, debug) if err != nil { return "", "", err } @@ -38,6 +44,10 @@ func GetOAuthToken(clientID, clientSecret, code, redirectURI string, debug bool) } func GetOAuthResponse(clientID, clientSecret, code, redirectURI string, debug bool) (resp *OAuthResponse, err error) { + return GetOAuthResponseContext(context.Background(), clientID, clientSecret, code, redirectURI, debug) +} + +func GetOAuthResponseContext(ctx context.Context, clientID, clientSecret, code, redirectURI string, debug bool) (resp *OAuthResponse, err error) { values := url.Values{ "client_id": {clientID}, "client_secret": {clientSecret}, @@ -45,7 +55,7 @@ func GetOAuthResponse(clientID, clientSecret, code, redirectURI string, debug bo "redirect_uri": {redirectURI}, } response := &OAuthResponse{} - err = post("oauth.access", values, response, debug) + err = post(ctx, "oauth.access", values, response, debug) if err != nil { return nil, err } |