title: Flask/Facebook: Flask-Oauth OAuthException: Missing redirect_uri parameter?
body: <p>I have a Flask app that I'm trying to authenticate with Facebook. Locally, it works perfectly fine. When I deploy to Heroku, it doesn't work, throwing the following error:</p>
  
  <pre><code>{u'error': {u'type': u'OAuthException', u'message': u'Missing redirect_uri parameter.', u'code': 191}}
  
  'Invalid response from facebook'
  </code></pre>
  
  <p>I've searched all over stackoverflow and google for the answer to this, but I can't seem to figure it out.</p>
  
  <p>I'm particularly confused as to why it's working locally and not deployed.</p>
  
  <p>As for my implementation, it's to the letter:</p>
  
  <pre><code>facebook = oauth.remote_app('facebook',
      base_url='https://graph.facebook.com/',
      request_token_url=None,
      access_token_url='/oauth/access_token',
      authorize_url='https://www.facebook.com/dialog/oauth',
      consumer_key=FACEBOOK_APP_ID,
      consumer_secret=FACEBOOK_APP_SECRET,
      request_token_params={'scope':'email,user_birthday,user_education_history,user_photos,publish_actions'}
      )
  
  @app.route('/login')
  def login():
      return facebook.authorize(callback=url_for('facebook_authorized',
          next=request.args.get('next') or request.referrer or None,
          _external=True))
  
  @app.route('/login/authorized')
  @facebook.authorized_handler
  def facebook_authorized(resp):
      if resp is None:
          error = 'Access denied: reason=%s error=%s' %(
              request.args['error_reason'],
              request.args['error_descriptions']
          )
          return render_template('home.html', error=error)
      xyz = (resp['access_token'], '')
      session['oauth_token'] = xyz
      me = facebook.get('/me')
      checkUser = db.session.query(User).filter(User.fid==me.data['id']).all()
      if not checkUser:
          fname = me.data['name'].split()[0]
          lname = me.data['name'].split()[-1]
          education=''
          if 'education' in me.data:
              education=me.data['education'][-1]['school']['name']
          newuser = User(me.data['id'], fname, lname, me.data['email'], me.data['username'], education)
          db.session.add(newuser)
          db.session.commit()
      flash('You were logged in')
      session['fid'] = me.data['id']
      return redirect(url_for('home'))
  
  @facebook.tokengetter
  def get_facebook_oauth_token():
      return session.get('oauth_token')
  </code></pre>
  
  <p>Anyone have any clues?</p>