I have node.js running ok with a Hello World example
I have installed
iMac-Home:myapp1 franceswarburton$ npm install express --save
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN app@1.0.0 No repository field.
express@4.16.2
added 49 packages in 2.81s
iMac-Home:myapp1 franceswarburton$ npm install passport
npm WARN app@1.0.0 No repository field.
passport@0.4.0
added 3 packages in 2.012s
iMac-Home:myapp1 franceswarburton$ npm install --save handlebars
npm WARN app@1.0.0 No repository field.
I don’t see any documentation on where to find SESSION_SECRET so I guessed I create my own
my app throws error
module.js:557
throw err;
^
Error: Cannot find module ‘express-session’
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object. (/Users/franceswarburton/myapp1/index.js:14:22)
at Module._compile (module.js:660:30)
at Object.Module._extensions…js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
What magical wizards am I not understating here guys.
The issue is not to do with the session secret variable, but that you’re requesting the express-session module which it can’t find. Are you sure you correctly downloaded all modules?
iMac-Home:myapp1 franceswarburton$ npm install express --save
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN app@1.0.0 No repository field.
express@4.16.2
added 49 packages in 2.81s
iMac-Home:myapp1 franceswarburton$ npm install passport
npm WARN app@1.0.0 No repository field.
passport@0.4.0
added 3 packages in 2.012s
iMac-Home:myapp1 franceswarburton$ npm install --save handlebars
npm WARN app@1.0.0 No repository field.
Use just npm install with no package name in the directory where package.json is, and it will install all the dependencies listed in package.json. If you didn’t use the file from that sample repo, check the list there. Generally everything you require should be npm installed.
The error here is “Parameter redirect_uri does not match registered URI”.
This means that the redirect URI you have saved to your application profile on dev.twitch.tv is different from the one you’re providing in the auth url as the callback.
I changed the settings in my application and got the twitch popup ‘allow access’ etc.
However I get the following:
InternalOAuthError: Failed to obtain access token
at OAuth2Strategy._createOAuthError (/Users/franceswarburton/myapp1/node_modules/passport-oauth2/lib/strategy.js:379:17)
at /Users/franceswarburton/myapp1/node_modules/passport-oauth2/lib/strategy.js:166:45
at /Users/franceswarburton/myapp1/node_modules/oauth/lib/oauth2.js:191:18
at passBackControl (/Users/franceswarburton/myapp1/node_modules/oauth/lib/oauth2.js:132:9)
at IncomingMessage. (/Users/franceswarburton/myapp1/node_modules/oauth/lib/oauth2.js:157:7)
at IncomingMessage.emit (events.js:165:20)
at endReadableNT (_stream_readable.js:1101:12)
at process._tickCallback (internal/process/next_tick.js:152:19)
The only thing I’m not clear on is
const SESSION_SECRET = ‘TEST123’;
I see in the Twitch settings I see client secret and a button to create a new.
Is this what I create or do I find this somewhere ?
Is this the issue now ?
The docs are not really clear from a beginners point of view.
const TWITCH_CLIENT_ID = ‘MY CLIENT ID’;
const TWITCH_SECRET = ‘MY TWITCH SECRET’;
const SESSION_SECRET = ‘TEST123’; // Where does this come from ???
const CALLBACK_URL = ‘AS PER THE DOCS’;