Server-side Flow Authentication with GAE failed
I want to implement sever side flow authetication on my GAE project.
first, I redirect the user to the OAuth Dialog to get the code.
then I try to authenticate my application with these code(I replace the sensitive part):
code = self.request.get('code')
url = 'https://graph.facebook.com/oauth/access_token?client_id=00000000000000&redirect_uri=http://000000000000.com/&client_secret=00000000&code=' + code
response = urllib2.urlopen(url)
content = response.read()
and I think I can get access token and expire time in the content variable
but what I got is just error message:
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 701, in __call__
handler.get(*groups)
File "/base/data/home/apps/s~livingtomato/1.353914368655529058/main.py", line 28, in get
response = urllib2.urlopen(url)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 124, in urlopen
return _opener.open(url, data)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 387, in open
response = meth(req, response)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 498, in http_response
'http', request, response, code, msg, hdrs)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 425, in error
return开发者_运维问答 self._call_chain(*args)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 360, in _call_chain
result = func(*args)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 506, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 404: Not Found
it's really odd, because if I print the url variable and link to the url with browser directly, I can get the access token and expire time successfully!
I'm really confused. Can someone help me?
Thanks! and I'm sorry for my poor English.
精彩评论