title: KeyError: 'name'
body: <p>I am trying to login with facebook on my web application.
  However, I keep getting this error message:</p>
  
  <pre><code> return self.view_functions[rule.endpoint](**req.view_args).
    File "/vagrant/itemcat2/application.py", 
    line 230, in fbconnect
    login_session['username'] = data["name"]
    KeyError: 'name'
  </code></pre>
  
  <p>Why does it say that the data name is a key error and it doesn't exist?
  How can I fix it? </p>
  
  <p>Below is the code the error message points to:</p>
  
  <p>url = '<a href="https://graph.facebook.com/v2.8/me?access_token=%s&amp;fields=name,id,email" rel="nofollow noreferrer">https://graph.facebook.com/v2.8/me?access_token=%s&amp;fields=name,id,email</a>' % token</p>
  
  <pre><code>h = httplib2.Http()
  result = h.request(url, 'GET')[1]
  
  data = json.loads(result)
  login_session['provider'] = 'facebook'
  login_session['username'] = data["name"]
  login_session['email'] = data["email"]
  login_session['facebook_id'] = data["id"]
  
  # Store token in login_session in order to logout
  stored_token = token.split("=")[1]
  login_session['access_token'] = stored_token
  </code></pre>