Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use correct content type for token request #308

Merged
merged 3 commits into from
Feb 12, 2024

Conversation

ewanharris
Copy link
Member

@ewanharris ewanharris commented Feb 9, 2024

Description

Updates the remaining SDKs to use the correct content type when making a token request.

  • .net - Needed to move to using FormUrlEncodedContent as the body and then the runtime will handle setting the Content-Type for us
  • Go - no work needed as this is done by the oauth2 package we included
  • JS - Set the header on the request and axios will serialize for us
  • Python - Set the header and pass post_params instead of body

This has been verified by running all 4 examples and providing credentials, where possible tests have been amended to assert we're passing the right header/body.

References

Closes #284
Language PRs to follow

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

@rhamzeh rhamzeh added this pull request to the merge queue Feb 12, 2024
github-merge-queue bot pushed a commit to openfga/dotnet-sdk that referenced this pull request Feb 12, 2024
## Description

Moves the client to use `application/x-www-form-urlencoded` for the
content type when making token requests per the spec.

In order to do this we needed to move from using `StringContent` to
`FormUrlEncodedContent` and then the runtime will handle setting the
content type header for us.

Also syncs some changes from the sdk-generator repo.

## References

Part of openfga/sdk-generator#284
Generated from openfga/sdk-generator#308

## Review Checklist
- [x] I have clicked on ["allow edits by
maintainers"](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork).
- [ ] I have added documentation for new/changed functionality in this
PR or in a PR to [openfga.dev](https://github.com/openfga/openfga.dev)
[Provide a link to any relevant PRs in the references section above]
- [x] The correct base branch is being used, if not `main`
- [ ] I have added tests to validate that the change in functionality is
working as expected
Merged via the queue into main with commit b5d3e34 Feb 12, 2024
13 checks passed
@rhamzeh rhamzeh deleted the fix/284-token-request-type branch February 12, 2024 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[All SDKS] Change OAuth2 credential request content type header to application/x-www-form-urlencoded
2 participants