diff --git a/.generator/config.yaml b/.generator/config.yaml index 43c3b903..daed8e46 100644 --- a/.generator/config.yaml +++ b/.generator/config.yaml @@ -8,7 +8,7 @@ additionalProperties: enumClassPrefix: true generateInterfaces: true packageName: okta - packageVersion: 4.0.0 + packageVersion: 4.1.0 useOneOfDiscriminatorLookup: true disallowAdditionalPropertiesIfNotPresent: false files: diff --git a/.generator/templates/client.mustache b/.generator/templates/client.mustache index 34c5b7ee..2c8a2b71 100644 --- a/.generator/templates/client.mustache +++ b/.generator/templates/client.mustache @@ -396,8 +396,12 @@ func getAccessTokenForPrivateKey(httpClient *http.Client, orgURL, clientAssertio tokenResponse.Body = origResp var accessToken *RequestAccessToken - if tokenResponse.StatusCode >= 400 && strings.Contains(string(respBody), "invalid_dpop_proof") { - return getAccessTokenForDpopPrivateKey(tokenRequest, httpClient, orgURL, "", maxRetries, maxBackoff) + if tokenResponse.StatusCode >= 300 { + if strings.Contains(string(respBody), "invalid_dpop_proof") { + return getAccessTokenForDpopPrivateKey(tokenRequest, httpClient, orgURL, "", maxRetries, maxBackoff) + } else { + return nil, "", nil, err + } } _, err = buildResponse(tokenResponse, nil, &accessToken) @@ -436,9 +440,14 @@ func getAccessTokenForDpopPrivateKey(tokenRequest *http.Request, httpClient *htt if err != nil { return nil, "", nil, err } - if tokenResponse.StatusCode >= 400 && strings.Contains(string(respBody), "use_dpop_nonce") { - newNonce := tokenResponse.Header.Get("Dpop-Nonce") - return getAccessTokenForDpopPrivateKey(tokenRequest, httpClient, orgURL, newNonce, maxRetries, maxBackoff) + + if tokenResponse.StatusCode >= 300 { + if strings.Contains(string(respBody), "use_dpop_nonce") { + newNonce := tokenResponse.Header.Get("Dpop-Nonce") + return getAccessTokenForDpopPrivateKey(tokenRequest, httpClient, orgURL, newNonce, maxRetries, maxBackoff) + } else { + return nil, "", nil, err + } } origResp := io.NopCloser(bytes.NewBuffer(respBody)) tokenResponse.Body = origResp diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d09ac54..8dfab6ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,13 @@ # Changelog Running changelog of releases since `2.0.0-rc.4` +## v4.1.0 + - Add support for dpop (#454) Thanks [@duytiennguyen-okta] + - Fix object that does not have additional properties (#456) Thanks [@duytiennguyen-okta] + - Fix header accept issue that only accept application/json (#457) Thanks [@duytiennguyen-okta] + ## v4.0.0 - - Release v4 version of the sdk base on openapi spec v3 (#427) Thanks [@duytiennguyen-okta] + - Release v4 version of the sdk base on openapi spec v3 (#4) Thanks [@duytiennguyen-okta] ## v2.19.0 - Upgrade dependency (#378) Thanks [@duytiennguyen-okta]