Typeform JS Client Authentication problem

  api, javascript, sdk, typeform

I’m having trouble with the Typeform JS client… (https://github.com/Typeform/js-api-client). I can’t access my data from the API call, the error raised is

Access to XMLHttpRequest at 'https://api.typeform.com/forms/Q65qbSSX' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

It seems that the problem is due to some OAuth2 access token, however this process is not mentioned in the JS Client documentation but only in the API documentation. The documentation is not very clear and got me very confused. I’m not sure that I need to authenticate through OAuth since I have a developer personal access token. Here again, the documentation is not very clear, and the JS client doesn’t mention OAuth. If anyone ever dealt with Typeform…

I also already tried using the Moesif addon, which made it work on my local server, but the problem persists in production on Heroku.

Source: Ask Javascript Questions

LEAVE A COMMENT