{"action":"opened","issue":{"url":"https://api.github.com/repos/benefitcloud/ember-uploader/issues/117","repository_url":"https://api.github.com/repos/benefitcloud/ember-uploader","labels_url":"https://api.github.com/repos/benefitcloud/ember-uploader/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/benefitcloud/ember-uploader/issues/117/comments","events_url":"https://api.github.com/repos/benefitcloud/ember-uploader/issues/117/events","html_url":"https://github.com/benefitcloud/ember-uploader/issues/117","id":158531184,"number":117,"title":"SignatureDoesNotMatch with S3","user":{"login":"GCorbel","id":1296201,"avatar_url":"https://avatars.githubusercontent.com/u/1296201?v=3","gravatar_id":"","url":"https://api.github.com/users/GCorbel","html_url":"https://github.com/GCorbel","followers_url":"https://api.github.com/users/GCorbel/followers","following_url":"https://api.github.com/users/GCorbel/following{/other_user}","gists_url":"https://api.github.com/users/GCorbel/gists{/gist_id}","starred_url":"https://api.github.com/users/GCorbel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GCorbel/subscriptions","organizations_url":"https://api.github.com/users/GCorbel/orgs","repos_url":"https://api.github.com/users/GCorbel/repos","events_url":"https://api.github.com/users/GCorbel/events{/privacy}","received_events_url":"https://api.github.com/users/GCorbel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-05T00:37:04Z","updated_at":"2016-06-05T00:37:04Z","closed_at":null,"body":"Hello,\r\n\r\nI followed the document to make the uploader working with amazon s3. He is the information on the request sent for signin : \r\n\r\n```\r\nGET /sign?name=15233.jpg&type=image%2Fjpeg&size=594730 HTTP/1.1\r\nHost: localhost:5000\r\nConnection: keep-alive\r\nPragma: no-cache\r\nCache-Control: no-cache\r\nAccept: application/json, text/javascript, */*; q=0.01\r\nOrigin: http://localhost:4200\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/49.0.2623.108 Chrome/49.0.2623.108 Safari/537.36\r\nAuthorization: Token token=\"CFTNWVvoUfUTTlsbA5xlqhC+4fFp9eeDdGAdPb1gZw68CitZYq2bNr0YB70FIKRaVWpX1YvXjxzX8qNVZXkfcQ==\"\r\nContent-Type: application/json\r\nReferer: http://localhost:4200/admin/settings\r\nAccept-Encoding: gzip, deflate, sdch\r\nAccept-Language: fr,en-US;q=0.8,en;q=0.6\r\n\r\nHTTP/1.1 200 OK\r\nX-Frame-Options: SAMEORIGIN\r\nX-XSS-Protection: 1; mode=block\r\nX-Content-Type-Options: nosniff\r\nContent-Type: application/json; charset=utf-8\r\nAccess-Control-Allow-Origin: http://localhost:4200\r\nAccess-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS\r\nAccess-Control-Max-Age: 1728000\r\nAccess-Control-Allow-Credentials: true\r\nVary: Origin\r\nETag: W/\"aa2678a3089107f7348f604b832c12b5\"\r\nCache-Control: max-age=0, private, must-revalidate\r\nX-Request-Id: c36cd155-fa7b-427b-82d8-8d695189bd0b\r\nX-Runtime: 0.019509\r\nTransfer-Encoding: chunked\r\n\r\n{\"acl\":\"public-read\",\"awsaccesskeyid\":\"AKIAIU3WOND2V6CWUW3Q\",\"bucket\":\"kohorde-files\",\"expires\":\"2016-06-05T10:15:21Z\",\"key\":\"uploads/15233.jpg\",\"policy\":\"eyJleHBpcmF0aW9uIjoiMjAxNi0wNi0wNVQxMDoxNToyMVoiLCJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJrb2hvcmRlLWZpbGVzIn0seyJhY2wiOiJwdWJsaWMtcmVhZCJ9LHsiZXhwaXJlcyI6IjIwMTYtMDYtMDVUMTA6MTU6MjFaIn0seyJzdWNjZXNzX2FjdGlvbl9zdGF0dXMiOiIyMDEifSxbInN0YXJ0cy13aXRoIiwiJGtleSIsIiJdLFsic3RhcnRzLXdpdGgiLCIkQ29udGVudC1UeXBlIiwiIl0sWyJzdGFydHMtd2l0aCIsIiRDYWNoZS1Db250cm9sIiwiIl0sWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsMCw1MjQyODgwMDBdXX0=\",\"signature\":\"rvTwmufS2azGLiMKrR/xzPEHk9o=\",\"success_action_status\":\"201\",\"Content-Type\":\"image/jpeg\",\"Cache-Control\":\"max-age=630720000, public\"}\r\n```\r\n\r\nAnd this is the request for upload\r\n```\r\nPOST / HTTP/1.1\r\nHost: kohorde-files.s3.amazonaws.com\r\nConnection: keep-alive\r\nContent-Length: 596428\r\nPragma: no-cache\r\nCache-Control: no-cache\r\nAccept: */*\r\nOrigin: http://localhost:4200\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/49.0.2623.108 Chrome/49.0.2623.108 Safari/537.36\r\nAuthorization:\r\nContent-Type: multipart/form-data; boundary=----WebKitFormBoundaryqRjT7BpEk1FOj1KK\r\nReferer: http://localhost:4200/admin/settings\r\nAccept-Encoding: gzip, deflate\r\nAccept-Language: fr,en-US;q=0.8,en;q=0.6\r\n\r\nHTTP/1.1 403 Forbidden\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Methods: GET, PUT, POST\r\nAccess-Control-Max-Age: 3000\r\nVary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method\r\nx-amz-request-id: 570B501023D8DDDD\r\nx-amz-id-2: bdTQvm2HNsk61Zc5bdEtnRYDIxjNQOuRGTb18+XgGiVB8gAzmg6/r+Uczq15MHB435d0e2Suj6k=\r\nContent-Type: application/xml\r\nTransfer-Encoding: chunked\r\nDate: Sun, 05 Jun 2016 00:15:54 GMT\r\nConnection: close\r\nServer: AmazonS3\r\n\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>AKIAIU3WOND2V6CWUW3Q</AWSAccessKeyId><StringToSign>eyJleHBpcmF0aW9uIjoiMjAxNi0wNi0wNVQxMDoxNToyMVoiLCJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJrb2hvcmRlLWZpbGVzIn0seyJhY2wiOiJwdWJsaWMtcmVhZCJ9LHsiZXhwaXJlcyI6IjIwMTYtMDYtMDVUMTA6MTU6MjFaIn0seyJzdWNjZXNzX2FjdGlvbl9zdGF0dXMiOiIyMDEifSxbInN0YXJ0cy13aXRoIiwiJGtleSIsIiJdLFsic3RhcnRzLXdpdGgiLCIkQ29udGVudC1UeXBlIiwiIl0sWyJzdGFydHMtd2l0aCIsIiRDYWNoZS1Db250cm9sIiwiIl0sWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsMCw1MjQyODgwMDBdXX0=</StringToSign><SignatureProvided>rvTwmufS2azGLiMKrR/xzPEHk9o=</SignatureProvided><StringToSignBytes>65 79 4a 6c 65 48 42 70 63 6d 46 30 61 57 39 75 49 6a 6f 69 4d 6a 41 78 4e 69 30 77 4e 69 30 77 4e 56 51 78 4d 44 6f 78 4e 54 6f 79 4d 56 6f 69 4c 43 4a 6a 62 32 35 6b 61 58 52 70 62 32 35 7a 49 6a 70 62 65 79 4a 69 64 57 4e 72 5a 58 51 69 4f 69 4a 72 62 32 68 76 63 6d 52 6c 4c 57 5a 70 62 47 56 7a 49 6e 30 73 65 79 4a 68 59 32 77 69 4f 69 4a 77 64 57 4a 73 61 57 4d 74 63 6d 56 68 5a 43 4a 39 4c 48 73 69 5a 58 68 77 61 58 4a 6c 63 79 49 36 49 6a 49 77 4d 54 59 74 4d 44 59 74 4d 44 56 55 4d 54 41 36 4d 54 55 36 4d 6a 46 61 49 6e 30 73 65 79 4a 7a 64 57 4e 6a 5a 58 4e 7a 58 32 46 6a 64 47 6c 76 62 6c 39 7a 64 47 46 30 64 58 4d 69 4f 69 49 79 4d 44 45 69 66 53 78 62 49 6e 4e 30 59 58 4a 30 63 79 31 33 61 58 52 6f 49 69 77 69 4a 47 74 6c 65 53 49 73 49 69 4a 64 4c 46 73 69 63 33 52 68 63 6e 52 7a 4c 58 64 70 64 47 67 69 4c 43 49 6b 51 32 39 75 64 47 56 75 64 43 31 55 65 58 42 6c 49 69 77 69 49 6c 30 73 57 79 4a 7a 64 47 46 79 64 48 4d 74 64 32 6c 30 61 43 49 73 49 69 52 44 59 57 4e 6f 5a 53 31 44 62 32 35 30 63 6d 39 73 49 69 77 69 49 6c 30 73 57 79 4a 6a 62 32 35 30 5a 57 35 30 4c 57 78 6c 62 6d 64 30 61 43 31 79 59 57 35 6e 5a 53 49 73 4d 43 77 31 4d 6a 51 79 4f 44 67 77 4d 44 42 64 58 58 30 3d</StringToSignBytes><RequestId>570B501023D8DDDD</RequestId><HostId>bdTQvm2HNsk61Zc5bdEtnRYDIxjNQOuRGTb18+XgGiVB8gAzmg6/r+Uczq15MHB435d0e2Suj6k=</HostId></Error>\r\n```\r\n\r\nHere is my controlller : \r\n\r\n```\r\nclass UploadsController < ApplicationController\r\n  def sign\r\n    expires = 10.hours.from_now.utc.iso8601\r\n    pp signature\r\n    render json: {\r\n      acl: 'public-read',\r\n      awsaccesskeyid: ENV['AWS_ACCESS_KEY_ID'],\r\n      bucket: ENV['AWS_BUCKET'],\r\n      expires: expires,\r\n      key: \"uploads/#{params[:name]}\",\r\n      policy: aws_policy(expires),\r\n      signature: signature,\r\n      success_action_status: '201',\r\n      'Content-Type' => params[:type],\r\n      'Cache-Control' => 'max-age=630720000, public'\r\n    }, status: :ok\r\n  end\r\n\r\n  private\r\n\r\n  def signature\r\n    Base64.strict_encode64(\r\n      OpenSSL::HMAC.digest(\r\n        OpenSSL::Digest::Digest.new('sha1'),\r\n        ENV['AWS_SECRET_ACCESS_KEY'],\r\n        aws_policy({ secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'] })\r\n      )\r\n    )\r\n  end\r\n\r\n  def aws_policy(expires)\r\n    Base64.strict_encode64(\r\n      {\r\n        expiration: expires,\r\n        conditions: [\r\n          { bucket: ENV['AWS_BUCKET'] },\r\n          { acl: 'public-read' },\r\n          { expires: expires },\r\n          { success_action_status: '201' },\r\n          [ 'starts-with', '$key', '' ],\r\n          [ 'starts-with', '$Content-Type', '' ],\r\n          [ 'starts-with', '$Cache-Control', '' ],\r\n          [ 'content-length-range', 0, 524288000 ]\r\n        ]\r\n      }.to_json\r\n    )\r\n  end\r\nend\r\n```\r\n\r\nWhat is my error? Thanks!\r\n"}}
{"actor":{"display_login":"GCorbel"}}