Generating Browser-Based Upload Parameters with Authentication Information
API Description
You can use this API to generate parameters for authentication. The parameters can be used to upload data through POST operations based on a browser.
![](https://support.huaweicloud.com/eu/api-obs_nodejs_sdk_api_en/public_sys-resources/note_3.0-en-us.png)
There are two request parameters generated:
- Policy, which corresponds to the policy field in the form
- Signature: which corresponds to the signature field in the form
Method Definition
ObsClient.createPostSignatureSync
Request Parameter
Field |
Type |
Optional or Mandatory |
Description |
---|---|---|---|
Bucket |
String |
Optional |
Bucket name |
Key |
String |
Optional |
Object name, corresponds to the key field in the form |
Expires |
Number |
Optional |
Expiration time of the browser-based authentication (unit: seconds). The default value is 300. |
FormParams |
Object |
Optional |
Other parameters of the browser-based upload except for key, policy, and signature. Possible values are:
|
Returned Result
Field |
Type |
Description |
---|---|---|
OriginPolicy |
String |
policy not encoded by Base64. This parameter can only be used for verification. |
Policy |
String |
policy in a form |
Signature |
String |
signature in the form |
Sample Code
var formParams = {acl: 'public-read', 'content-type': 'text/plain'}; var res = obsClient.createPostSignatureSync({Bucket: 'bucketname', Key: 'objectkey', Expires:3600, FormParams: formParams}); console.log('Policy-->' + res['Policy']); console.log('Signature-->' + res['Signature']);
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.