My react app gets user data from github using graphql and the requests are made through a personal access token on a .env file.
My .env file is on the root folder of my project. The key is on the left and the key value (personal access token) is on the right:
.env file: REACT_APP_GITHUB_PERSONAL_ACCESS_TOKEN=xxxXXX
My code is in the App.js file which is inside the component folder which is inside the src folder.
Path to App.js -> ./src/components/App.js
Inside my App.js I have the following code on lines 6-10:
const axiosGitHubGraphQL = axios.create({
baseURL: 'https://api.github.com/graphql',
headers: {
Authorization: `bearer ${process.env.REACT_APP_GITHUB_PERSONAL_ACCESS_TOKEN}`,
},
});
Through this code I can make requests to github using my personal access token which is inside the .env file, but the file is not working.
Dos anyone have a clue why my .env file does not work?
My react app is on github on the link:https://github.com/rvmelo/tech6-app
(NOTE: I followed the first steps from the tutorial on this link: https://www.robinwieruch.de/react-with-graphql-tutorial/)