Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

throw new TypeError('OAuth2Strategy requires a clientID option'); }

This is the error coming what to do.I have created a socket.io chat application.

This is a chat application using nodejs.socket.io and with package.json as -

Package.json

"dependencies": {
    "body-parser": "~1.15.1",
    "connect-flash": "^0.1.1",
    "connect-mongo": "^1.3.2",
    "cookie-parser": "^1.4.3",
    "debug": "~2.3.2",
    "escape-html": "^1.0.3",
    "express": "~4.14.0",
    "express-session": "^1.14.2",
    "hbs": "~4.0.0",
    "mongoose": "^4.6.8",
    "morgan": "~1.7.0",
    "passport": "^0.3.2",
    "passport-facebook": "^2.1.1",
    "passport.socketio": "^3.7.0",
    "serve-favicon": "~2.3.0",
    "shortid": "^2.2.6",
    "socket.io": "^1.5.1",
    "twemoji": "^2.2.0"
  },
  "devDependencies": {
    "babel-preset-es2015": "^6.18.0",
    "gulp": "^3.9.1",
    "gulp-autoprefixer": "^3.1.1",
    "gulp-babel": "^6.1.2",
    "gulp-clean-css": "^2.0.13",
    "gulp-htmlmin": "^3.0.0",
    "gulp-imagemin": "^3.1.1",
    "gulp-sass": "*",
    "gulp-uglify": "^2.0.0"
  }
}

C:\Users\AAKASH\Desktop\Follower-Github\Chat-app-all-F-2\Babble-master\B
abble-master\node_modules\passport-oauth2\lib\strategy.js:82            
  if (!options.clientID) { throw new TypeError('OAuth2Strategy requires 
a clientID option'); }                                                  
                           ^                                            

TypeError: OAuth2Strategy requires a clientID option                    
    at Strategy.OAuth2Strategy (C:\Users\AAKASH\Desktop\Follower-Github\
Chat-app-all-F-2\Babble-master\Babble-master\node_modules\passport-oauth
2\lib\strategy.js:82:34)                                                
    at new Strategy (C:\Users\AAKASH\Desktop\Follower-Github\Chat-app-al
l-F-2\Babble-master\Babble-master\node_modules\passport-facebook\lib\str
ategy.js:54:18)                                                         
    at Object.<anonymous> (C:\Users\AAKASH\Desktop\Follower-Github\Chat-
app-all-F-2\Babble-master\Babble-master\config\passport.js:11:14)       
    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)                          
    at Module.require (module.js:604:17)                                
    at require (internal/module.js:11:18)                               
    at Object.<anonymous> (C:\Users\AAKASH\Desktop\Follower-Github\Chat-
app-all-F-2\Babble-master\Babble-master\routes\index.js:9:14)           
    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)                          
    at Module.require (module.js:604:17)                                
    at require (internal/module.js:11:18)                               
    at Object.<anonymous> (C:\Users\AAKASH\Desktop\Follower-Github\Chat-
app-all-F-2\Babble-master\Babble-master\app.js:23:16)                   
    at Module._compile (module.js:660:30)                               
    at Object.Module._extensions..js (module.js:671:10)                 
    at Module.load (module.js:573:32)                                   
npm ERR! code ELIFECYCLE                                                
npm ERR! errno 1                                                        
npm ERR! [email protected] start: `node ./bin/www`                           
npm ERR! Exit status 1                                                  
npm ERR!                                                                
npm ERR! Failed at the [email protected] start script.                       
npm ERR! This is probably not a problem with npm. There is likely additi
onal logging output above.                                              

npm ERR! A complete log of this run can be found in:                    
npm ERR!     C:\Users\AAKASH\AppData\Roaming\npm-cache\_logs\2018-06-08T
03_18_29_207Z-debug.log                                                 

Below is of no use.......
This is the error coming what to do.I have created a socket.io chat application. This is a chat application using nodejs.socket.io and with package.jsonThis is the error coming what to do.I have created a socket.io chat application. This is a chat application using nodejs.socket.io and with package.jsonThis is the error coming what to do.I have created a socket.io chat application. This is a chat application using nodejs.socket.io and with package.json

like image 647
ADD Avatar asked Dec 13 '22 16:12

ADD


1 Answers

Recently, I faced the same issue and later I realized that I forgot to require .env configuration.

Error

TypeError: OAuth2Strategy requires a clientID option

Fix

npm i dotenv

and then require it at the top of your file

require(dotenv).config()

The issue is caused because your server has no idea that it has to use the environment variable.

like image 96
Vishal Singh Avatar answered Dec 21 '22 09:12

Vishal Singh