auth0 - 将范围分配给由 Auth0 Manager API 创建的资源服务器
问题描述
我想使用 Auth0 管理器 API https://auth0.com/docs/api/management/v2#!/Resource_Servers/post_resource_servers创建 Auth0 的资源服务器
一切正常,但是当我想创建定义字段范围的资源服务器时会出错,因为范围接收类型数组 [对象]
现在的问题是,如何获取范围对象?,我无法创建对象范围。
试试这个,但不起作用:
"scopes": [{"name":"read:data", "description":"some description"}]
还有这个:
"scopes": [{"permission":"read:data", "description":"some description"}]
代码片段:
from auth0.v3.management import Auth0
auth0 = Auth0(domain, token)
data = {
"name": 'somename',
"identifier": 'somename',
"signing_alg": 'RS256',
"allow_offline_access": True,
"token_lifetime": 91234,
"skip_consent_for_verifiable_first_party_clients": True,
"scopes": [{"name":"read:data", "description":"some description"}]
}
try:
status = auth0.resource_servers.create(body=data)
print '\nAPI CREATED CORRECTLY\n'
except Exception as e:
print '\nAPI ERROR CREATING RESOURCE SERVER!!'
print e
所有其他领域都可以正常工作,唯一给我带来问题的是scopes。
解决方案
试试这种格式:
"scopes": [
{
"description": "Read Client Grants",
"value": "read:client_grants"
},
{
"description": "Create Client Grants",
"value": "create:client_grants"
}
]
推荐阅读
- python - 如何从谷歌数据流apache束python中的GCS存储桶中读取多个JSON文件
- javascript - 使用 Sequelize 的关联:多对多关系
- tensorflow - 如何使用 anaconda 安装 tensorflow_hub (windows)
- autotools - 使用非 Automake 外部库进行 distclean 中断
- mysql - AWS DMS - 源 S3,目标 Aurora MySQL - 错误 - 无效的 utf8mb4 字符串
- r - ggplot2中同一轴上的不同刻度长度
- python - 扩展 numpy 数组
- azure-cosmosdb - 如何使用 SQL API 在 Azure Cosmos DB 中使用聚合函数
- kotlin - 无法在 Kotlin 中导入类文件
- c# - .NET Framework 4.6 中 GStreamer 的 DLL 名称映射问题