update: package version

This commit is contained in:
Sakurasan
2024-10-21 16:24:58 +08:00
parent 0c99913e91
commit ae3b72c0ff
4 changed files with 168 additions and 92 deletions

View File

@@ -31,6 +31,7 @@ import (
"fmt"
"net/http"
"net/url"
"os"
"time"
"github.com/golang-jwt/jwt"
@@ -132,7 +133,14 @@ func exchangeJwtForAccessToken(signedJWT string) (string, error) {
data.Set("grant_type", "urn:ietf:params:oauth:grant-type:jwt-bearer")
data.Set("assertion", signedJWT)
resp, err := http.PostForm(authURL, data)
client := http.DefaultClient
if os.Getenv("LOCAL_PROXY") != "" {
if proxyUrl, err := url.Parse(os.Getenv("LOCAL_PROXY")); err == nil {
client.Transport = &http.Transport{Proxy: http.ProxyURL(proxyUrl)}
}
}
resp, err := client.PostForm(authURL, data)
if err != nil {
return "", err
}