这是用例:组件TableGroup应要求用户指定data属性,该属性是要在表中呈现的对象数组或 requestDataUrl组件将从其中获取该对象数组的属性。简而言之,这两个属性中的一个是必需的,但不是两者都需要。我如何在以下component.propTypes对象中实现这一目标?
TableGroup.propTypes = {
fieldNames: React.PropTypes.array.isRequired,
dataFields: React.PropTypes.array.isRequired,
uniqueField: React.PropTypes.string.isRequired,
data: React.PropTypes.array,
requestUrlSource: http://someurl/api/resource
}
Run Code Online (Sandbox Code Playgroud) 我已Authorization在我的 Auth0 帐户中安装了该扩展程序,因此授权功能可以完美运行,但现在我想访问我在该授权扩展程序中创建的所有组。因此,我遵循了授权文档,但是当我使用为其生成的令牌时,它会403: Insufficient scope在响应中抛出错误。
这些是我经历过的步骤:
1.请求令牌:
curl -X POST \
https://my_domain.auth0.com/oauth/token \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-d '{
"client_id":"auth0-authorization-extension-api-client-id",
"client_secret":"auth0-authorization-extension-api-secret",
"audience":"urn:auth0-authz-api",
"grant_type":"client_credentials"
}'
Run Code Online (Sandbox Code Playgroud)
回复:
Run Code Online (Sandbox Code Playgroud){"access_token":"encoded_access_token","expires_in":86400,"token_type":"Bearer"}
2.请求组列表:
curl -X GET \
https://domain.us.webtask.io/some_hash/api/groups \
-H 'authorization: Bearer access_token'
Run Code Online (Sandbox Code Playgroud)
回复:
Run Code Online (Sandbox Code Playgroud){ "statusCode": 403, "error": "Forbidden", "message": "Insufficient scope" }