KeyError: 'name'

by Jennie kone   Last Updated September 15, 2019 19:26 PM - source

I am trying to login with facebook on my web application. However, I keep getting this error message:

return self.view_functionsrule.endpoint. File "/vagrant/itemcat2/", line 230, in fbconnect login_session['username'] = data["name"] KeyError: 'name'

Below is the code the error message points to:

url = ',id,email' % token

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

Related Questions

Facebook SDK - Valid OAuth redirect URIs

Updated December 21, 2017 12:26 PM

Get an OAuth users news feed using Facebooks api

Updated August 12, 2017 09:26 AM