Python中的FIWARE OAuth2身份验证
我正在尝试使用FIWARE对用户进行身份验证 它返回一个404。因此,在步骤1本身失败。什么是访问令牌url?还有其他要检查的指针吗 我尝试了“oauth/access\u token”、“oauth/token”、“oauth2/token”、“oauth2/access\u token”的变体。它们似乎都不起作用 我的代码如下:Python中的FIWARE OAuth2身份验证,python,oauth,fiware,Python,Oauth,Fiware,我正在尝试使用FIWARE对用户进行身份验证 它返回一个404。因此,在步骤1本身失败。什么是访问令牌url?还有其他要检查的指针吗 我尝试了“oauth/access\u token”、“oauth/token”、“oauth2/token”、“oauth2/access\u token”的变体。它们似乎都不起作用 我的代码如下: import oauth2 as oauth # OAuth secret into your project's settings. consumer = o
import oauth2 as oauth
# OAuth secret into your project's settings.
consumer = oauth2.Consumer(settings.FIWARE_CLIENT_ID,settings.FIWARE_CLIENT_SECRET)
client = oauth2.Client(consumer)
access_token_url = 'https://account.lab.fiware.org/oauth2/access_token'
# This is the slightly different URL used to authenticate/authorize.
authenticate_url = 'https://account.lab.fiware.org/oauth2/authorize'
def fiware_login(request):
# Step 1. Get a request token from FIWARE.
resp, content = client.request(access_token_url, "GET")
print resp
if resp['status'] != '200':
print content
raise Exception("Invalid response from FIWARE.")
# Step 2. Redirect the user to the authentication URL.
url = "%s?access_token=%s" % (authenticate_url,
resp['access_token'])
return HttpResponseRedirect(url)
正确的端点是“/oauth2/token”
也许你应该使用POST方法而不是GET
有关更多信息,请参阅