You can check the api docs here: developers.forem.com/api
I am currently working on this still. Here is my code for example.
axios.get("https://dev.to/api/articles/me/published", { headers: { 'api-key': process.env.REACT_APP_DEV_API_KEY, }, }).then(res => console.log(res)).catch(err => console.log(err));
but I keep getting an error message saying I am not authorized.
Your request seems fine.
I've tried it right now and got the same problem.
Maybe a problem with the api endpoint.
In a strange way making the request through curl worked for me.
Found the problem.
It's CORS.
Actually CORS is disabled for public API requests but not for restricted endpoints.
Take a look in some workarounds:
dev.to/jrsofty/cors-problem-workar...
I appreciate this! Thank you for being such great help
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can check the api docs here: developers.forem.com/api
I am currently working on this still. Here is my code for example.
but I keep getting an error message saying I am not authorized.
Your request seems fine.
I've tried it right now and got the same problem.
Maybe a problem with the api endpoint.
In a strange way making the request through curl worked for me.
Found the problem.
It's CORS.
Actually CORS is disabled for public API requests but not for restricted endpoints.
Take a look in some workarounds:
dev.to/jrsofty/cors-problem-workar...
I appreciate this! Thank you for being such great help