From 7962f4a16d2f5072b5725b2a2581f85b5bb34ef3 Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Thu, 10 Feb 2022 23:35:06 +0900 Subject: [PATCH] oauth: fix OAuthV2Response to corresponde to latest API Signed-off-by: Koichi Shiraishi --- oauth.go | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/oauth.go b/oauth.go index d9aca5f3b..0a04a4468 100644 --- a/oauth.go +++ b/oauth.go @@ -33,17 +33,18 @@ type OAuthResponse struct { // OAuthV2Response ... type OAuthV2Response struct { - AccessToken string `json:"access_token"` - TokenType string `json:"token_type"` - Scope string `json:"scope"` - BotUserID string `json:"bot_user_id"` - AppID string `json:"app_id"` - Team OAuthV2ResponseTeam `json:"team"` - IncomingWebhook OAuthResponseIncomingWebhook `json:"incoming_webhook"` - Enterprise OAuthV2ResponseEnterprise `json:"enterprise"` - AuthedUser OAuthV2ResponseAuthedUser `json:"authed_user"` - RefreshToken string `json:"refresh_token"` - ExpiresIn int `json:"expires_in"` + AccessToken string `json:"access_token"` + TokenType string `json:"token_type"` + Scope string `json:"scope"` + BotUserID string `json:"bot_user_id"` + AppID string `json:"app_id"` + Team OAuthV2ResponseTeam `json:"team"` + IncomingWebhook OAuthResponseIncomingWebhook `json:"incoming_webhook"` + Enterprise OAuthV2ResponseEnterprise `json:"enterprise"` + AuthedUser OAuthV2ResponseAuthedUser `json:"authed_user"` + RefreshToken string `json:"refresh_token"` + ExpiresIn int `json:"expires_in"` + IsEnterpriseInstall bool `json:"is_enterprise_install"` SlackResponse } @@ -61,10 +62,12 @@ type OAuthV2ResponseEnterprise struct { // OAuthV2ResponseAuthedUser ... type OAuthV2ResponseAuthedUser struct { - ID string `json:"id"` - Scope string `json:"scope"` - AccessToken string `json:"access_token"` - TokenType string `json:"token_type"` + ID string `json:"id"` + Scope string `json:"scope"` + AccessToken string `json:"access_token"` + TokenType string `json:"token_type"` + RefreshToken string `json:"refresh_token,omitempty"` + ExpiresIn int `json:"expires_in,omitempty"` } // GetOAuthToken retrieves an AccessToken