r/webdev - API token added to GitHub Secrets in my repo, deploying GitHub Pages, how do I access this Secret in Javascript? (Simple Node.js project)

This is added to the GitHub pages branch.

My package.json
at the moment looks like this:

  "name": "project",
  "version": "1.0.0",
  "description": "project",
  "main": "app.js",
  "dependencies": {
    "dotenv": "^8.2.0",
    "gh-pages": "^3.1.0"
  "devDependencies": {},
  "scripts": {
    "deploy": "gh-pages -d ."
  "author": "",
  "license": "ISC",
  "homepage": "https://steviejeebies.github.com/github-pages-test"

Up until now, I’ve stored my Token in a token.js file (which was in .gitignore), imported that into my HTML through a <src>.

When I’ve deployed the app with npm run deploy, I don’t know exactly how to access this token value. What do I have to change in package.json, and in my Javascript?

Source link

Write A Comment