TypeError: OAuthStrategy requires a consumerKey option

Viewed 1492

I keep getting this error when I added the twitter OAuth to my application. I currently have google OAuth which works fine, but adding twitter is causing the error. I don't see viable solution in all the previous posts on this error; can anyone help please? here is the code snippet for the twitter- it is the same as the google one.

passport.use(
  new TwitterStrategy({
      twitterclientID: keys.twitterclientID,
      twitterclientSecret: keys.twitterclientSecret,
      callbackURL: '/auth/twitter/callback',
      proxy: true
    }
3 Answers

Replace twitterclientID with consumerKey & Replace twitterclientSecret with consumerSecret

Recently google also does the same thing so you need to update for google as well since you are using google oauth

passport.use(
  new TwitterStrategy({
      consumerKey: theClientID,
      consumerSecret: theClientSecret,
      callbackURL: '/auth/twitter/callback',
      proxy: true
    }
passport.use(
  new TwitterStrategy({
      consumerKey: keys.twitterclientID,
      consumerSecret: keys.twitterclientSecret,
      callbackURL: '/auth/twitter/callback',
      proxy: true
    }

I had already declared consumerKey and consumerSecret. The issue for me was, that the environment variables used as the values for both keys, were not defined.

If you use netlify the issue may be solved after running netlify link.

Related