title: Passport.js Facebook Strategy not working because URL Blocked
body: <p>I'm getting this error when I go to localhost:3000 and use the login with facebook button. </p>
  
  <blockquote>
    <p>URL Blocked: This redirect failed because the redirect URI is not
    whitelisted in the app’s Client OAuth Settings. Make sure Client and
    Web OAuth Login are on and add all your app domains as Valid OAuth
    Redirect URIs.</p>
  </blockquote>
  
  <p>Even when I'm not logged in on facebook, and I try to get directed to facebook for login, I get a blank page with this error instead</p>
  
  <blockquote>
    <p>Not Logged In: You are not logged in. Please login and try again.</p>
  </blockquote>
  
  <p>Here's my auth module's index.js:</p>
  
  <pre><code>'use strict';
  const passport = require('passport');
  const config = require('../config');
  const h = require('../helpers');
  const FacebookStrategy = require('passport-facebook').Strategy;
  
  module.exports = () =&gt; {
      passport.serializeUser((user, done) =&gt; {
          done(null, user.id);
      });
  
      passport.deserializeUser((id, done) =&gt; {
          //Find the user using the _id
          h.findById(id)
              .then(user =&gt; done(null, user))
              .catch(error =&gt; console.log('Error when deserializing user'));
      });
  
      let authProcessor = (accessToken, refreshToken, profile, done) =&gt; {
          // Find a user in the local db using profile.id
          // If the user is found, return the user data using the done() method
          // If the user is not found, create one in the local db and return
          h.findOne(profile.id)
              .then(result =&gt; {
                  if(result) {
                      done(null, result);
                  } else {
                      // Create a new user and return
                      h.createNewUser(profile)
                          .then(newChatUser =&gt; done(null, newChatUser))
                          .catch(error =&gt; console.log("Error when creating a new user"))
                  }
              })
      }
      passport.use(new FacebookStrategy(config.fb, authProcessor));
  </code></pre>
  
  <p>Here's my config / development.json file. I took out the values of dbURI and fb clientID &amp; secret, but in my development, those values do exist and were obtained from their respective providers.</p>
  
  <pre><code>{
      "host": "http://localhost:3000",
      "dbURI": "",
      "sessionSecret": "catscanfly",
      "fb": {
          "clientID": "",
          "clientSecret": "",
          "calbackURL": "//localhost:3000/auth/facbeook/callback",
          "profileFields": ["id", "displayName", "photos"]
      }
  }
  </code></pre>
  
  <p><a href="https://github.com/RoadToCode822/catchat" rel="nofollow">Whole app on github</a> </p>