1

I'm trying to use the Form Post middleware (enabled) with OpenStack Swift. I've the following code in php:

    $expires = intval(time() + 60*1000);
    $path = '/v1/AUTH_xxxxxxxxx/mycontainer';
    $max_file_count = 1;
    $max_file_size = 104857600;
    $redirect = '';

    $key = 'testkey';

    $hmac_body = sprintf("%s\n%s\n%d\n%d\n%d", $path, $redirect, $max_file_size, $max_file_count, $expires);

    $sig = hash_hmac('sha1', $hmac_body, $key);

And my Ajax call is the following:

Upload.http({
    url: uploadLink.url, //includes path
    method: 'POST',
    data: {
        redirect: uploadLink.redirect,
        max_file_size: uploadLink.max_file_size,
        max_file_count: uploadLink.max_file_count,
        expires: uploadLink.expires,
        signature: uploadLink.sig,
        file: file
    }
})

But the result is 401 status code. When I try with the tempUrl middleware, it works fine (so the Temp-URL-Key works and CORS too). I've tried with Postman, it did not work.

Do you have any idea?

acorbel
  • 1,300
  • 12
  • 14

0 Answers0