English 中文(简体)
能否用“Facebook”,我接下来的欺骗步骤是什么?
原标题:Can t OAuth with Facebook; what are my next debugging steps?

I ve got a Django model thatstarts the Facebook OAuth process:

window.location= https://www.facebook.com/dialog/oauth?client_id=MY_CLIENT_ID&redirect_uri=http%3A//localhost%3A8000/fbpanel/explore-python 

接着,在我的达詹戈看来,我收到以下法典:

import cgi
import urllib

# [...]

code = request.GET[ code ]
args = {
     client_id : MY_CLIENT_ID,
     redirect_uri :  http://localhost:8000/fbpanel/explore_python 
     client_secret : MY_CLIENT_SECRET,
     code : code,
}
url =  https://graph.facebook.com/oauth/access_token?  +  
        urllib.urlencode(args)

raw_response = urllib.urlopen(url).read()
response = cgi.parse_qs(raw_response)    

if response:
    error =   
    if response[ access_token ]:
        access_token = response[ access_token ][0]
    if response[ expires ]:
        expires = response[ expires ][0]
else:
    access_token =  No access token returned 
    expires =  No expiration given 
    error = raw_response

Invariably, response is None and raw_response contains Error: {"error":{"message":"Error validating verification code.","type":"OAuthException"}}

同样的全权证书与。 我的服务器对<代码> 当地东道<>/代码>也有约束力,并且有<代码> 当地东道:8000在我的官方相关领域建立。 在我这样做之前, Java将做些工作。 之后,它就这样做了。 因此,我不认为<代码>就地标/代码”是问题。

I ve manually stepped through the code, printing the code returned by FB out, then manually running the above code line by line in the python interpreter, and I can t see anything I m doing wrong. What are my next debugging steps? The FB documentation offers little guidance if you receive an OAuthException.

最佳回答

<代码>redirect_uri 当你请求打上标语时,与你要求该编码时一样。 由于在请求标注时没有发生任何实际的转移,因此很容易造成小的分歧。 这一错误信息并非特别描述;其实际含义是“你所发送的参数与你所寄送的代码值不相符”。

问题回答

暂无回答




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签