Forem Creators and Builders 🌱

matfire
matfire

Posted on • Updated on

API: dev.to cors error

Hey all,
I'm trying to build an online markdown editor that can publish to multiple platforms at once (dev.to, hashnode, maybe medium etc). I found the documentation page and have created an api key for my profile to test this out, but when I send the request to create an article, this is the result I get back the following error message:

Access to fetch at 'https://dev.to/api/articles' from origin 'https://ffyt6r-5173.csb.app' has been blocked by CORS policy: Request header field api-key is not allowed by Access-Control-Allow-Headers in preflight response.
Enter fullscreen mode Exit fullscreen mode

Anyone ever had to deal with this ? Any help would be appreciated :)

Edit: turns out you can only access endpoints requiring an API key from a server; moving the execution over there from my frontend code solved my issue. Thanks Michael!

Top comments (0)