junhoyeo / threads-api

Unofficial, Reverse-Engineered Node.js/TypeScript client for Meta's Threads. Web UI Included.
https://threads.junho.io
MIT License
1.58k stars 134 forks source link

Axios - Network Error #148

Open kevinfosse opened 11 months ago

kevinfosse commented 11 months ago

Hello @junhoyeo, now that the 'fs' module work, i'm coming with a new problem..

Maybe it's my i'm bad but i got this error: image

Then, i put my console.log here :

An attempt to set a forbidden header was blocked: origin page.js line 359 > eval:2351:16 An attempt to set a forbidden header was blocked: Sec-Fetch-Site page.js line 359 > eval:2351:16 An attempt to set a forbidden header was blocked: referer page.js line 359 > eval:2351:16 An attempt to set a forbidden header was blocked: sec-fetch-dest page.js line 359 > eval:2351:16 An attempt to set a forbidden header was blocked: sec-fetch-mode page.js line 359 > eval:2351:16 An attempt to set a forbidden header was blocked: sec-fetch-user page.js line 359 > eval:2351:16 Cross-Origin Request Blocked: The "Same Origin" policy does not allow accessing the remote resource located at https://www.threads.net/@unyxes. Reason: The CORS header "Access-Control-Allow-Origin" is missing. Status code: 200.

Cross-Origin Request Blocked: The "Same Origin" policy does not allow accessing the remote resource located at https://www.threads.net/@unyxes. Reason: CORS request failed. Status code: (null).

yssf-io commented 11 months ago

It looks like you're trying to access the API from the client side, which is not supported yet.

Since you're using Next you could try to put the API calls in the server side.

junhoyeo commented 11 months ago

Hmm I see you're using next.js app router. Strange, we're also using it inside page.tsx in web-ui: https://github.com/junhoyeo/threads-api/blob/main/threads-web-ui/app/%5Busername%5D/page.tsx#L14

junhoyeo commented 11 months ago

@kevinfosse Can you make/share a repro repo?

kevinfosse commented 11 months ago

@yssf-io @junhoyeo

Hi, you can close this issue, I switched to Express on the backend to use threads-api and React on the frontend, it seems to work better, no 'fs' or axios problems.

Thank you all for your help lately, take care