Comments (8)
The code I used:
$assemblyinstructions = array(
'auth' => array(
"key" => "2b0c45611f6440dfb64611e872ec3211",
"expires" => "2010/10/19 09:01:20+00:00"
),
"steps" => array(
"encode" => array(
"robot"=> "/video/encode"
)
)
);
// Generate signature via their PHP sdk.
$authKey = '2b0c45611f6440dfb64611e872ec3211';
$authSecret = "d805593620e689465d7da6b8caf2ac7384fdb7e9";
$transloadit = new \transloadit\Transloadit(array('key' => $authKey, 'secret' => $authSecret));
$assembly = $transloadit->request($assemblyinstructions, false);
$signature = $assembly->signString($assembly->getParamsString());
from php-sdk.
Hi @thisisboris, any reason you're not using an a UTC date for expiry in the future?
Also, please remove your auth & secret keys from this ticket as it's a public and community maintained sdk
from php-sdk.
Thanks for the fast reply @kvz,
This is all straight from transloadit docs, no data of mine was shown. The authsecret is a fake from the public docs. (https://transloadit.com/docs/api-docs#authentication (2.4 Example))
from php-sdk.
Ah ok : )
Have you checked out this project's readme and its examples? https://github.com/transloadit/php-sdk/blob/master/example/1-assembly-request.php
I think it handles the expiry keys itself.
Looks like you are going by the API docs, which go in depth as you should be able to build your own sdk with them, but this sdk already abstracts that logic away for convenience
from php-sdk.
It'll probably help if I expain that I'm trying to use this SDK to easily generate the signature I need. Frontend-code is AngularJS with ng-transloadit. It requires sending with signatures so I use a AJAX-get to generate my signature. However, so far all signatures have been returned as being wrong. The API-suggested php-code does not work for me. Not with templates, not without.
The SDK does indeed supply the expiry date by itself, for testing purposes I have no put the line 31 - 34 in TransloaditRequest.php in a commentblock (Where the auth-array is overridden with a more up-to-date expiry date) so that it does no longer exhibit that behavior.
I've now discovered that, when passing assembly instructions, I should pass them beneath a 'params' key (I didn't notice this in the examples before now). So that is my fault.
However, even then with the fixture (Straight from the docs):
{
"auth": {
"key": "dd75298ccbf7416caed06de6eca5cd27",
"expires": "2014/06/10 10:48:38+00:00"
},
"steps": {
"store": {
"robot": "/sftp/store",
"user": "some_user",
"host": "example.org",
"path": "uploads/dir/${file.url_name}"
}
},
"template_id": "some_template_id"
}
Which internally creates the JSONstring and signature upon the following PHP-array:
Array
(
[auth] => Array
(
[key] => dd75298ccbf7416caed06de6eca5cd27
[expires] => "2014/06/10 10:48:38+00:00"
)
[steps] => Array
(
[store] => Array
(
[robot] => /sftp/store
[user] => some_user
[host] => example.org
[path] => uploads/dir/${file.url_name}
)
)
[template_id] => some_template_id
)
I still get the wrong signature...
Got:
da09a5fb1ac88e8fbf5c6b6f632cb131fba42c9d
Whilst the fixture-modal tells me I should get
0d6fc64c946b8e1cf057396445b98166b0ffb887
Are there any PHP.ini settings that may cause this? I do not know of one that might.
from php-sdk.
I think as of php 5.4 some options to json_encode were added if you're looking to get a signature compatible with javascript. http://www.php.net//manual/en/function.json-encode.php. E.g. iirc JSON_UNESCAPED_UNICODE is one difference with js.
Magic quotes may also impact the behavior, if you're asking about php.ini settings that could affect the functions involved.
A third possibility is you're 'contaminating' the params in javascript after the signature has been calculated.
Does that help at all?
from php-sdk.
It does, I have now a few leads to look into to find how the 'bug' is happening. Thanks a lot, if I find what it was I will post it here as a comment and close.
Thanks for the help and patience.
from php-sdk.
Closed, because this issue is 3 years old and no one else has reported anything similar.
Please feel free to re-open this if you still need help.
from php-sdk.
Related Issues (20)
- Method for passing files to be uploaded is deprecated HOT 3
- Doesn't work for PHP 5.6.15? HOT 2
- Deprecation warning HOT 6
- Add `Transloadit-Client: php-sdk:<version>` header to each request
- Implement "waitForCompletion" parameter for the createAssembly function
- Relative path breaks implementation on missing version HOT 2
- Request async HOT 4
- Lib does not return exception HOT 8
- What do you think to split the createAssembly in two methods? HOT 2
- Update example of using jQuery SDK to using Uppy instead. HOT 4
- proposal for new major HOT 15
- If using 'tmp_file' you will need to use move_uploaded_file() first HOT 4
- add uploaded files to assembly HOT 2
- Fix pipelines HOT 3
- Remove files not used HOT 3
- Coverage analisys HOT 5
- Test skipped HOT 3
- Is it still maintained? HOT 1
- Make timeouts configurable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-sdk.