@@ -53,7 +53,11 @@ func validateToken(ctx context.Context, p Provider, accessToken string, header h
5353 endpoint := p.Data().ValidateURL.String()
5454 if len(header) == 0 {
5555 params := url.Values{"access_token": {accessToken}}
56− endpoint = endpoint + "?" + params.Encode()
56+ if hasQueryParams(endpoint) {
57+ endpoint = endpoint + "&" + params.Encode()
58+ } else {
59+ endpoint = endpoint + "?" + params.Encode()
60+ }
5761 }
5862
5963 result := requests.New(endpoint).
@@ -74,3 +78,13 @@ func validateToken(ctx context.Context, p Provider, accessToken string, header h
7478 logger.Errorf("token validation request failed: status %d - %s", result.StatusCode(), result.Body())
7579 return false
7680}
81+
82+// hasQueryParams check if URL has query parameters
83+func hasQueryParams(endpoint string) bool {
84+ endpointURL, err := url.Parse(endpoint)
85+ if err != nil {
86+ return false
87+ }
88+
89+ return len(endpointURL.RawQuery) != 0
90+}