Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple-js-oauth displays Error: secret option required for sessions in log and UI #22

Closed
jcranfordupgrade opened this issue Jul 6, 2023 · 1 comment

Comments

@jcranfordupgrade
Copy link

I tried running simple-js-oauth. It starts, but I get the error when I open http://localhost:8000. See the error at the end of this issue.

To workaround the problem, I googled the error and found a one-line workaround. I edited server.js to set a missing secret in the app object.

const app = express();
app.use(session({ secret: 'somevalue' })); // The fix
const moment = require("moment");

Please consider adding the missing secret, otherwise simple-js-oauth doesn't run properly and gives the following error in UI and log.

Error: secret option required for sessions
    at session (/Users/jcranford/github/workspaces/plaid/tutorial-resources/worktree/oauth2/vanilla-js-oauth/start/node_modules/express-session/index.js:200:12)
    at Layer.handle [as handle_request] (/Users/jcranford/github/workspaces/plaid/tutorial-resources/worktree/oauth2/vanilla-js-oauth/start/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/jcranford/github/workspaces/plaid/tutorial-resources/worktree/oauth2/vanilla-js-oauth/start/node_modules/express/lib/router/index.js:323:13)
    at /Users/jcranford/github/workspaces/plaid/tutorial-resources/worktree/oauth2/vanilla-js-oauth/start/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/Users/jcranford/github/workspaces/plaid/tutorial-resources/worktree/oauth2/vanilla-js-oauth/start/node_modules/express/lib/router/index.js:341:12)
    at next (/Users/jcranford/github/workspaces/plaid/tutorial-resources/worktree/oauth2/vanilla-js-oauth/start/node_modules/express/lib/router/index.js:275:10)
    at expressInit (/Users/jcranford/github/workspaces/plaid/tutorial-resources/worktree/oauth2/vanilla-js-oauth/start/node_modules/express/lib/middleware/init.js:40:5)
    at Layer.handle [as handle_request] (/Users/jcranford/github/workspaces/plaid/tutorial-resources/worktree/oauth2/vanilla-js-oauth/start/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/jcranford/github/workspaces/plaid/tutorial-resources/worktree/oauth2/vanilla-js-oauth/start/node_modules/express/lib/router/index.js:323:13)
    at /Users/jcranford/github/workspaces/plaid/tutorial-resources/worktree/oauth2/vanilla-js-oauth/start/node_modules/express/lib/router/index.js:284:7
@phoenixy1
Copy link
Collaborator

Hmm, I took a look but I wasn't able to reproduce this issue as described. When running the code according to the README, it worked. Also, there is no folder called simple-js-oauth in this repo, although there is vanilla-js-oauth, which already sets the secret in the app object in server.js line 13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants