【问题标题】:OAuth2 Session - How to add multiple scopes?OAuth2 会话 - 如何添加多个范围?
【发布时间】:2021-06-21 13:05:39
【问题描述】:

我正在尝试添加多个范围,但似乎不是在 url 中添加空格,而是添加了 +。我不确定如何确保添加空间。我将范围存储在列表中。

CALLBACK_URL = 'https://localhost/callback'
CLIENT_SECRET = SETTINGS['client_secret']
CLIENT_SCOPES = ['esi-mail.organize_mail.v1 ', 'esi-mail.send_mail.v1 ', 'esi-assets.read_assets.v1 ',
                 'esi-characters.read_blueprints.v1 ', 'esi-assets.read_corporation_assets.v1 ',
                 'esi-corporations.read_blueprints.v1 ']
ENDPOINT = 'https://login.eveonline.com/oauth/authorize'


def oauth_session(client_id, client_secret, scopes):
    client = OAuth2Session(client_id, client_secret, scope=scopes)
    uri, state = client.create_authorization_url(ENDPOINT)
    return uri, state

响应将以下内容显示为范围(为简洁起见,仅显示范围):

&scope=esi-mail.organize_mail.v1++esi-mail.send_mail.v1++esi-assets.read_assets.v1++esi-characters.read_blueprints.v1++esi-assets.read_corporation_assets.v1++esi-corporations.read_blueprints.v1+

是我使用了错误的数据结构,还是我遗漏了什么?

【问题讨论】:

    标签: scopes authlib


    【解决方案1】:

    原来问题根本不是范围的格式 - 我缺少我正在使用的 API 所需的 redirect_uri。

    【讨论】:

      猜你喜欢
      • 2012-01-16
      • 1970-01-01
      • 2021-12-04
      • 1970-01-01
      • 1970-01-01
      • 2023-03-04
      • 1970-01-01
      • 2022-01-21
      • 2011-12-31
      相关资源
      最近更新 更多