okta / okta-sdk-golang

A Golang SDK for interacting with the Okta management API, enabling server-side code to manage Okta users, groups, applications, and more.
https://github.com/okta/okta-sdk-golang
Other
173 stars 143 forks source link

Add User-Agent header to `POST /oauth2/v1/token` OAuth token request #408

Closed monde closed 10 months ago

monde commented 10 months ago

Describe the bug?

The POST /oauth2/v1/token OAuth token request is not adding a User-Agent header as occurs with all other API requests.

Perhaps add a unit test for this.

What is expected to happen?

User-Agent header added

What is the actual behavior?

It isn't added

Reproduction Steps?

Make an OAuth request

Additional Information?

No response

Golang Version

any

SDK Version

all

OS version

No response

duytiennguyen-okta commented 10 months ago

internal reference https://oktainc.atlassian.net/browse/OKTA-658719

m3talsmith commented 10 months ago

@monde I'm curious where this is happening myself. I dove through the code some and found that code calling the (*RequestExecutor).NewRequest(...) method always gets the UserAgent assigned. It might be a matter of that method not being called at one point in the API.

Deep diving here to see what I can come up with.

m3talsmith commented 10 months ago

It could also be in that same file in this function which is autogenerated.

monde commented 10 months ago

It could also be in that same file in this function which is autogenerated.

Yes, for the v3 client in the template you've referenced.

The v2 okta-sdk-golang client is vendor'd into the okta terraform provider, this where I hacked that in: https://github.com/okta/terraform-provider-okta/blob/master/sdk/v2_requestExecutor.go#L295C40-L295C40