Hi @Robin1243 – it looks like the request body is missing the action field for which the client-token is to be granularly scoped for.
Rather than generating client-tokens yourself, we recommend letting the library handle that by implementing your dwollaAPIToken() function in the following way:
tokenUrl endpoint implementation (the dwollaAPIToken function acts as passthrough between your client-side where the drop-in component lives, and the server-side which makes the calls to the Dwolla API as shown below) :
/**
* Using Dwolla Node.js SDK - https://github.com/Dwolla/dwolla-v2-node
* Refer to Step 1 on setup and configuration of Dwolla SDK
*/
app.post("/tokenUrl", function (req, res) {
generateClientTokenWithBody(req.body).then((clientTokenRes) => {
console.log(clientTokenRes);
res.send({ token: clientTokenRes.token });
});
});
function generateClientTokenWithBody(body) {
const url = `/client-tokens`;
return dwolla
.post(url, body)
.then((response) => {
return response.body;
})
.catch((error) => {
return error;
});
}
Hope this helps! Let us know if you have any questions!