=== PHP ===
[php]<?php/** * Questions: * The webservice url is vws.vuforia.com ??? */ini_set('display_errors', '1');error_reporting(-1);$VUFORIA_WEBSERVICE_BASEURL = "vws.vuforia.com";$contentType = "application/json";//$contentType = "multipart/form-data";//$clientAccessKey = "af8531bdbc4e16301ce161b71f40519cd362d815";//$clientSecretKey = "65fc6958a85c20f25dde1eee64fac4d4c0ef9ea5";$serverAccessKey = "5dff4c7b228a19389e1038789a3cdf89be3a2d71";$serverSecretKey = "dce9683e1188befeb3e867193fc81c16d574bbc2";$imageTestUrl = "http://img4-2.cookinglight.timeinc.net/i/Oxmoor/oh3360p161-all-american-chili-l.jpg";$imageEncodedBase64 = getImageData($imageTestUrl);$requestBody = createRequestBodyJson('oh3360p161-all-american-chili-l.jpg', "400", $imageEncodedBase64);//echo "Request body:".$requestBody;date_default_timezone_set('America/New_York');//date_default_timezone_set('GMT');$date = date("D, d F o h:i:s e");$lf = "\n"; //'U+000A'//$lf = PHP_EOL;//$lf = 'U+000A';//Signature = Base64(HMAC-SHA1(server_secret_key, StringToSign ) ) ;//StringToSign =//HTTP-Verb + "\n" +//Content-MD5 + "\n" +//Content-Type + "\n" +//Date + "\n" +//Request-Path;$stringToSign = "POST" . $lf . md5($requestBody) . $lf . $contentType . $lf . $date . $lf . //e.g.:Date: Mon, 23 April 2012 12:45:19 GMT "/targets";$signature = base64_encode(hash_hmac('sha1', $stringToSign, $serverSecretKey));$authString = "VWS " . $serverAccessKey . ":" . $signature;$headerArray = array( 'POST /targets HTTP/1.1', 'Authorization: ' . $authString, 'Host: ' . $VUFORIA_WEBSERVICE_BASEURL, 'Date: ' . $date, 'Content-Type: ' . $contentType, 'Request-Path: ' . '/targets');print_r($headerArray);postIt($requestBody, $headerArray);/* * POST /targets HTTP/1.1Host: vws.vuforia.comDate: Mon, 23 April 2012 12:45:19 GMTAuthorization: VWS df8d23140eb443505c0661c5b58294ef472baf64:jHX6oLeqTXpynyqcvVC2MSHarhUContent-Type: application/json{“name”:”test”,“width”:20,“image”:”…base64 encoded image data…”,“application_metadata”:”… base64 encoded data..”} */function postIt($requestBody, $headerArray){ global $VUFORIA_WEBSERVICE_BASEURL; $ch = curl_init(); $timeout = 10; curl_setopt($ch, CURLOPT_URL, 'https://'. $VUFORIA_WEBSERVICE_BASEURL . '/targets'); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 ); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody); curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray); //curl_setopt($ch, CURLINFO_HEADER_OUT, 1); $data = curl_exec($ch); $response = curl_getinfo($ch); if (curl_errno($ch)) { print 'CURL ERROR '.curl_error($ch); print 'ERROR #' . curl_errno($ch); } else { curl_close($ch); } echo PHP_EOL ."Response:" . print_r($data, true); echo PHP_EOL.PHP_EOL."Info:" .print_r($response, true);}function createRequestBodyJson($name, $width, $image) { $body = array( 'name' => $name, 'width' => floatval($width), 'image' => $image ); return json_encode($body);}function getImageData($url) { return base64_encode(file_get_contents($url));}?>
[/php]
authentication fails
To confirm, have you been able to execute any other provisioning requests or queries - or are they all returning this error?
Also can you post, or PM me, your request body, so that I can validate it?
authentication fails
Try revising the format of your Date field. That appears to be the culprit. You should use GMT and the abbreviated form of the month, without punctuation (i.e. Sep ).
authentication fails
Per agreement with Roy I am re posting here from an email thread:
Please have some look at it as I am out of ideas. Havent tried any other methods as this is the first part of our use case (to upload photos)
authentication fails
Please look in the source of the previous post - for some reason nothing is showing but its all there...thanks!
authentication fails
Please see the PM I've sent you.
Hello, Could you tell me what
Hello,
Could you tell me what was the solution, because im stuck with the same problem.
Im still trying but always get something like this: {"result_code":"AuthenticationFailure","transaction_id":"7c9ebae3e7a5403b8b91714ef84203e7"}
There can be multiple for
There can be multiple for causes authentication errors, improperly formatted field values are a common one. Do you have our Cloud Reco Java samples?
No, i dont. Thats why im
No, i dont. Thats why im trying with php:)
Cloud Reco Java samples
Could you please indicate, where the Cloud Reco Java samples can be downloaded from? Thanks mARc
Here you go
Here you go https://developer.vuforia.com/sites/default/files/vuforia-web-services-sample-code-2-0-0.zip
SignatureBuilder needed?
Hi David, thanks for the fast reply! After double checking the files from the link below and the description on the "setting up the API" page did I see that the file SignatureBuilder is not included in the java sample code. Is this file obsolete or am I missing something? Oh, ..
authentication fails
I have same problem.
I'm using php and curl and this is my request and respose:
authentication fails
@ Creadsmedia:
you can have a look in this thread (where some PHP code snippets from various developers have been shared):
https://developer.vuforia.com/forum/general-discussion/vws-authorization-problem