我应该为“OpenID Connect - 获取令牌”的 clientid 和 secret 指定什么值?

What values do I specify for clientid and secret for `OpenID Connect - Get a token`?

我想使用 REST API 检索 IAM 令牌,您可以使用“bx iam oauth-tokens”命令检索该令牌:

$ bx login --apikey @myapikey.json
$ bx iam oauth-tokens
IAM token:  Bearer ****
UAA token:  Bearer ****

通过设置BLUEMIX_TRACE=true,可以看到有对https://iam.ng.bluemix.net/oidc/token的调用。

我发现 docs for the token service 提供了以下信息:

Authorization Authorization Token used for the request. The supported token type is a basic auth token containing a clientid and secret. If the token is omitted, a default client configuration will be used which can only interact with Api Keys.'

var options = {
  "method": "POST",
  "hostname": "localhost",
  "port": "443",
  "path": "//oidc/token",
  "headers": {
    "authorization": "string",
    "accept": "application/json",
    "content-type": "application/x-www-form-urlencoded"
  }
};

我应该为 clientidsecret 设置什么?我是否需要从另一个 API 调用中获取这些值?

推荐的方式是省略授权header。所以这个调用应该有效(请注意,我使用全局端点 iam.bluemix.net 以获得最佳可用性,以及新的上下文路径 /identity/token):

curl -d "grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=<your API key>" https://iam.bluemix.net/identity/token