achievements-app/psn-api

cant get it to work with react js

Closed this issue · 3 comments

I can't seem to fetch any data when using react but if i just use plain vanilla JS it work great.

This one works great (vanilla JS)
idk

but whenever i try to do the same thing in react i keep getting an 403 / forbidden error or an incorrect Npsso error. (the npsso is 100% correct)

Screenshot 2023-09-19 195220
idk-react

if possible can you get back to me with a possible solution. Pretty sure i'm just messing up somewhere but i cant seem to find it

thing to note:
I added a proxy to the package.json file it was :localhost://8080. just in case that is useful

When using vanilla JS, are you making these calls client-side or server-side?

Client side

Sony themselves block client-side calls with their CORS policy. To get this working, you'll probably need to set up an API layer in Node.js that uses psn-api, then have your React front-end call those API endpoints.