コード例 #1
0
ファイル: views.py プロジェクト: taras1k/lottery
 def post(self, request, *args, **kwargs):
     signed_request = request.POST.get("signed_request")
     signed_request = SignedRequest.parse(signed_request, FACEBOOK_APP_SECRET)
     self.data["fb"] = signed_request
     if "oauth_token" not in signed_request:
         self.data["oauth_url"] = get_auth_url()
     else:
         self.data["page_install_url"] = get_page_install_url()
         oauth_token = signed_request["oauth_token"]
         graph = GraphAPI(oauth_token)
         self.data["fb"]["user"] = graph.get("me")
     return self.render_to_response(self.data)
コード例 #2
0
ファイル: views.py プロジェクト: taras1k/lottery
 def post(self, request, *args, **kwargs):
     signed_request = request.POST.get("signed_request")
     signed_request = SignedRequest.parse(signed_request, FACEBOOK_APP_SECRET)
     self.data["fb"] = signed_request
     self.data["sig_rec"] = signed_request
     if "oauth_token" not in signed_request:
         self.data["oauth_url"] = get_auth_url()
     else:
         oauth_token = signed_request["oauth_token"]
         graph = GraphAPI(oauth_token)
         self.data["fb"]["user"] = graph.get(signed_request.get("page").get("id", 0))
         request.session["admin"] = True
         request.session["token"] = oauth_token
         request.session["page_id"] = signed_request.get("page").get("id", 0)
     return self.render_to_response(self.data)