From 86047f8e6cf1b8128f418e17b0cfdd1bed90b01a Mon Sep 17 00:00:00 2001 From: Cristian Thompson Date: Wed, 7 Jun 2017 15:51:21 -0300 Subject: [PATCH 1/2] Adjust the token processing to be more clear removed un-used code inside fbconnect that outlined a needless url declaraction --- Lesson4/step2/project.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Lesson4/step2/project.py b/Lesson4/step2/project.py index 734023f..45b5266 100644 --- a/Lesson4/step2/project.py +++ b/Lesson4/step2/project.py @@ -55,18 +55,11 @@ def fbconnect(): app_id, app_secret, access_token) h = httplib2.Http() result = h.request(url, 'GET')[1] + # process the result into a python array using json.loads + result_array = json.loads(result) - - # Use token to get user info from API - userinfo_url = "https://graph.facebook.com/v2.8/me" - ''' - Due to the formatting for the result from the server token exchange we have to - split the token first on commas and select the first index which gives us the key : value - for the server access token then we split it on colons to pull out the actual token value - and replace the remaining quotes with nothing so that it can be used directly in the graph - api calls - ''' - token = result.split(',')[0].split(':')[1].replace('"', '') + # select the access_token from the processed array + token = result_array['access_token'] url = 'https://graph.facebook.com/v2.8/me?access_token=%s&fields=name,id,email' % token h = httplib2.Http() From f7a57a01388f2f85e5019a0529ab979855b878a9 Mon Sep 17 00:00:00 2001 From: Cristian Thompson Date: Wed, 7 Jun 2017 15:52:31 -0300 Subject: [PATCH 2/2] remove a stray button tag wrapping the FB button this button tag prevented clicking and utilizing the fb login feature --- Lesson4/step2/templates/login.html | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Lesson4/step2/templates/login.html b/Lesson4/step2/templates/login.html index ba2472a..f42c7cb 100644 --- a/Lesson4/step2/templates/login.html +++ b/Lesson4/step2/templates/login.html @@ -129,17 +129,10 @@ } - -