当我尝试文档中的示例时出现400 错误
settings.py
INSTALLED_APPS = (
'oauth_provider',
'django.contrib.auth',
)
OAUTH_SIGNATURE_METHODS = ['hmac-sha1',]
当我这样做时
>>> from oauth_provider.models import Resource, Consumer
>>> resource = Resource(name='photos', url='/oauth/photo/')
>>> resource.save()
>>> CONSUMER_KEY = 'dpf43f3p2l4k3l03'
>>> CONSUMER_SECRET = 'kd94hf93k423kf44'
>>> consumer = Consumer(key=CONSUMER_KEY, secret=CONSUMER_SECRET,
... name='http://127.0.0.1:9000', user=jane)
>>> consumer.save()
>>> from django.test.client import Client
>>> c = Client()
>>> import time
>>> parameters = {
... 'oauth_consumer_key': CONSUMER_KEY,
... 'oauth_signature_method': 'PLAINTEXT',
... 'oauth_signature': '%s&' % CONSUMER_SECRET,
... 'oauth_timestamp': str(int(time.time())),
... 'oauth_nonce': 'requestnonce',
... 'oauth_version': '1.0',
... 'oauth_callback': 'http://127.0.0.1:9000/request_token_ready',
... 'scope': 'photos',
... }
>>> response = c.get("/oauth/request_token/", parameters)
>>> response.status_code
400
我在配置中遗漏了什么吗?我找不到有关如何执行此操作的良好文档?