我在 IBM Cloud 上创建了一个 NodeJS 应用程序并将其与 App ID 服务连接起来。在该服务中,我添加了一个用户并设置了重定向 URI。通过使用 Cloud Directory 作为身份提供者,我可以使用用户帐户成功登录,并且可以看到/userinfo
ID 和访问令牌(持有者)。我想更改和添加该用户的属性,但我的 PUT 或 POST 请求不起作用。但是,我的 GET 请求正在运行:
curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer token' 'https://appid-oauth.eu-gb.bluemix.net/oauth/v3/91c8d285-580a-47ae-8928-e47e17127a35/userinfo'
我尝试了以下 PUT 和 POST 请求:
curl -X POST --header 'Content-Type: text/plain' --header 'Accept: application/json' --header 'Authorization: Bearer token' -d 'value' 'https://appid-profiles.ng.bluemix.net/userinfo'
和这个:
curl -X POST --header 'Content-Type: text/plain' --header 'Accept: application/json' --header 'Authorization: Bearer token' -d 'attributeValue' 'https://appid-profiles.ng.bluemix.net/api/v1/attributes/attributeName'
这是回应:
Error 404: SRVE0295E: Error reported: 404
使用邮递员,响应是:
Cannot POST or PUT /oauth/v3/91c8d285-58.../api/v1/attributes
如何使用 REST API 向用户添加属性?