From 00c6b6612ef75bf0082e568cb6f747c115fbe76c Mon Sep 17 00:00:00 2001 From: "kansai.okadome" Date: Thu, 31 Mar 2022 13:00:17 +0900 Subject: [PATCH] =?UTF-8?q?[Add]=20token=20request=E6=99=82=E3=81=AE?= =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=83=8F=E3=83=B3=E3=83=89=E3=83=AA?= =?UTF-8?q?=E3=83=B3=E3=82=B0=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/service/authorization/authorization.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sdk/service/authorization/authorization.go b/sdk/service/authorization/authorization.go index e0f2c70..2613fed 100644 --- a/sdk/service/authorization/authorization.go +++ b/sdk/service/authorization/authorization.go @@ -2,6 +2,7 @@ package srvauth import ( "context" + "fmt" "io/ioutil" "log" "net/http" @@ -50,11 +51,14 @@ func (self *CiosAuth) GetAccessTokenOnClient() (sdkmodel.AccessToken, sdkmodel.S values.Add("client_id", self.clientId) values.Add("client_secret", self.clientSecret) values.Add("scope", self.scope) - resp, _ := http.Post( + resp, err := http.Post( self.Url+"/connect/token", "application/x-www-form-urlencoded", strings.NewReader(values.Encode()), ) + if err != nil { + return "", "", "", 0, fmt.Errorf("failed to request token: %w", err) + } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body)