github register a new OAuth application and fetch details of app registered, client ID and secret.
As we can't keep them in source code, we will save them in a file on project root folder/.env.local
.env.local
---------------
REACT_APP_GITHUB_CLIENT_ID='<copied from github app page>'
REACT_APP_GITHUB_CLIENT_SECRET='<copied from github app page>'
So, instead of open request to Github api, use below one.
using ` instead of ' below as ${} is there to expand.
const res = await axios.get(`https://api.github.com/users?client_id=${process.env.REACT_APP_GITHUB_CLIENT_ID}&client_secret=${process.env.REACT_APP_GITHUB_CLIENT_SECRET}`);
No comments:
Post a Comment