monday-sdk-js
monday-sdk-js copied to clipboard
monday.oauthToken always fails
Describe the bug Using monday sdk on server side to exchange the code for an token fails with an empty error
Steps to reproduce
- Embed the SDK in an app
- Call
monday.oauthToken( "code", MONDAY_APP_CLIENT_ID, MONDAY_APP_CLIENT_SECRET )
- See the request fails with an empty error
- ...
Expected behavior auth token should be returned
Context and environment Used inside lambda function on NodeJs environment
Additional information
Although in the documentation is specified that the parameters should be sent as x-form-urlencoded : https://apps.developer.monday.com/docs/oauth
looks like the library itself is not respecting that and is using body as string :
await fetch.nodeFetch(url, {
method: options.method || "POST",
body: JSON.stringify(data || {}),
headers: {
Authorization: token,
"Content-Type": "application/json"
}
});
in oauth-service.js
execute(data, null, { url: MONDAY_OAUTH_TOKEN_URL });
this method is invoked which uses inside body as string
this can be the issue probably...