MohammedRaji / react-ig-feed

A React component to display a user's Instagram photos Using Instagram Basic Graph API
https://mohammedraji.github.io/react-ig-feed/
MIT License
43 stars 23 forks source link

Security issue with token? #14

Open Pixelatex opened 2 years ago

Pixelatex commented 2 years ago

Hello there,

Isn't it a risk to expose the token like this? Considering that this is likely to be used on a public-facing page somewhere means that random people could find your token.

I understand you trying to make a working one-stop component but you could address this risk in the readme. Fetching the feed on the backend and only using this component as a frontend component to show the feed result is a much safer method.

MohammedRaji commented 2 years ago

Thank you for your suggestion For more security you can use .env variables

luke-underwood commented 2 years ago

Hi! Using .env variables would not solve the issue as the token would still be leaked client-side

Flaaj commented 2 years ago

Hi! Using .env variables would not solve the issue as the token would still be leaked client-side

The token can be leaked, in fb developers account you can specify app domains and if somebody wants to use your token outside of your domain he will get cors error

thomcrielaard commented 2 years ago

I think using .env variables indeed does not solve the token. You can use server-sided .env variables; but then the token will be marked as "undefined", since the call is done client sided. On the other hand, using client-sided .env variables makes no difference, since they are client sided (or am I missing something?)