Skip to content

Commit

Permalink
Get jwt secret from env var
Browse files Browse the repository at this point in the history
  • Loading branch information
luucvanderzee committed Aug 5, 2024
1 parent 884e4ef commit f683f8d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules

# Local VsCode config
.vscode/*
.vscode/*

env_files/*
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ make feature-toggle feature=fake_sso enabled=true
npm i
```

4. In both repos, run the docker compose file:
4. In this repo, create a file called `back-secret.env` in the `env_files` folder, and make sure it has the correct `FAKE_SSO_JWT_SECRET`. It should match the one in `env_files/back-secret.env` in the main repo.

5. In both repos, run the docker compose file:

```
docker compose up
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.1",
"private": true,
"scripts": {
"start": "nodemon ./bin/www"
"start": "nodemon ./bin/www --env-file=env_files/back-secret.env"
},
"dependencies": {
"cookie-parser": "~1.4.4",
Expand All @@ -16,4 +16,4 @@
"nodemon": "^3.1.4",
"uuid": "^10.0.0"
}
}
}
4 changes: 1 addition & 3 deletions utils/createIdToken.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const jose = require("jose");
const { v4: uuidv4 } = require("uuid");

const secret = new TextEncoder().encode(
"cc7e0d44fd473002f1c42167459001140ec6389b7353f8088f4d9a95f2f596f2"
);
const secret = new TextEncoder().encode(process.env.FAKE_SSO_JWT_SECRET);

const alg = "HS256";

Expand Down

0 comments on commit f683f8d

Please sign in to comment.