小编aqu*_*man的帖子

如何在 React 组件 PropTypes 中定义替代的必需属性?

这是用例:组件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)

reactjs react-proptypes

5
推荐指数
2
解决办法
2419
查看次数

请求 Auth0-Authorization 扩展中的组列表但返回 403: 范围不足错误

我已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)

回复:

{"access_token":"encoded_access_token","expires_in":86400,"token_type":"Bearer"}
Run Code Online (Sandbox Code Playgroud)

2.请求组列表:

 curl -X GET \
  https://domain.us.webtask.io/some_hash/api/groups \
  -H 'authorization: Bearer access_token'
Run Code Online (Sandbox Code Playgroud)

回复:

{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "Insufficient scope"
}
Run Code Online (Sandbox Code Playgroud)

authorization oauth-2.0 auth0

1
推荐指数
1
解决办法
323
查看次数