how external app can access ibm cloud object storage

柔情痞子 提交于 2019-12-11 14:43:47

问题


I have IBM COS service and able to use Curl command via cli to retrieve objects. I used IAM tokens to retrieve. But how do I let an external web app ex., node access this service?

what value should be there in authorization for external app access?


回答1:


External apps will come in the form of something like the AWS CLI or any other app that uses either an HTTP library coupled with IBM Cloud Object Storage API or even an SDK for languages like Python, Java or Node.Js

All of the above will ask you for access key and secret key.

You can get both of them from the IBM Cloud console by generating new HMAC Credentials [1]:

  1. Navigate to your Cloud Object storage account
  2. Click on right under Service credentials
  3. Click New credentials button on right
  4. For the "Add Inline Configuration Parameters (Optional)" text box enter the following JSON: {"HMAC":true}

[1] https://console.bluemix.net/docs/services/cloud-object-storage/iam/service-credentials.html#service-credentials




回答2:


We'll you could use the ibm-cos-sdk Node library https://www.npmjs.com/package/ibm-cos-sdk. You'll need to use your HMAC credentials.

var config = {
    endpoint: '<endpoint>',
    ibmAuthEndpoint: 'https://iam.ng.bluemix.net/oidc/token',
    serviceInstanceId: '<resource-instance-id>',
    accessKeyId: '<HMAC access_key>',
    secretAccessKey: '<HMAC secret access key>'
};


来源:https://stackoverflow.com/questions/48923572/how-external-app-can-access-ibm-cloud-object-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!