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

Unable to Generate Token using api Package due to Schema Mismatch #269

Closed
basiq-ash opened this issue Aug 20, 2023 · 2 comments
Closed

Unable to Generate Token using api Package due to Schema Mismatch #269

basiq-ash opened this issue Aug 20, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@basiq-ash
Copy link
Collaborator

I have been attempting to integrate with the Basiq API (v3) by following the documentation provided at https://api.basiq.io/reference/posttoken. My goal is to generate a new token. While I was successful in achieving this using tools like Postman and curl, I encountered consistent errors when trying to implement the same functionality using the provided Node.js example with the api package.

The primary issue is that regardless of the data I provided in the request body, I received errors indicating that the body was missing. This is perplexing since I ensured that the request body was formatted according to the documentation.

Upon closer investigation, I discovered that the issue lies within the api package's implementation, specifically in the prepareParams function located at https://github.com/readmeio/api/blob/main/packages/api/src/core/prepareParams.ts#L269. This function expects a schema entry with the type body. However, for the /token endpoint, the content type is set to application/x-www-form-urlencoded, resulting in the schema being generated with formData instead of body. Consequently, the body information is being removed from the request.

Interestingly, this problem seems to be isolated to the /token endpoint. Other endpoints function as expected, using the application/json content type and interacting well with the api package.

@basiq-ash basiq-ash added the bug Something isn't working label Aug 20, 2023
@basiq-ash basiq-ash self-assigned this Aug 20, 2023
@basiq-ash
Copy link
Collaborator Author

This was identified as a bug and raised with api package maintainers.

readmeio/api#697

@basiq-ash
Copy link
Collaborator Author

basiq-ash commented Aug 20, 2023

This issue is now resolved with release: https://github.com/readmeio/api/releases/tag/v6.1.1

Bug fix: readmeio/api#699

@basiq-ash basiq-ash assigned basiq-ash and unassigned basiq-ash Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant