【问题标题】:FIWARE OAuth2 Authentication in PythonPython 中的 FIWARE OAuth2 身份验证
【发布时间】:2015-04-13 17:51:27
【问题描述】:

我正在尝试使用 FIWARE 对用户进行身份验证。

它返回 404。因此在步骤 1 本身失败。什么是访问令牌 url?任何其他要检查的指针

我尝试了 'oauth/access_token', 'oauth/token' 'oauth2/token' 'oauth2/access_token' 的变体。它们似乎都不起作用。

我的代码如下:

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)

【问题讨论】:

    标签: python oauth fiware


    【解决方案1】:

    正确的端点是“/oauth2/token”。

    也许你应该使用 POST 方法而不是 GET。

    欲了解更多信息,请参阅https://github.com/ging/fi-ware-idm/wiki/Using-the-FI-LAB-instance

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-27
      • 2015-07-12
      • 2015-08-31
      • 2018-09-01
      相关资源
      最近更新 更多