Home>

fails to execute the request, gives an error {"Messages": ["The_tonce_is_invalid"]}

Error is associated with a tag of time, but it does not turn out to overcome it. Maybe there are ideas?

<
? php.
REQUIRE __DIR __. '/.. /vendor /autoload.php';
Use GuzzleHtttp \ Client;
$ Public_Key= '';
$ secret_key= '';
$ client= new client ([
    'Base_uri'= >
 'https://api.kuna.io',
]);
//$ api_path= '/v3 /auth /kuna_codes /issued-by-me';
$ API_PATH= '/V3 /Auth /Me';
$ NONCE= STRVAL (DATE_TIMESTAMP_GET (DATE_CREATE ()));
//$ NONCE= TIME ();
$ Data= (Object) [];
$ Headers= [
    //'Accept'= >
 'Application /Json',
    //'Content-Type'= >
 'Application /Json',
    'kun-nonce'= >
 $ nonce
    'kun-apikey'= >
 $ Public_Key,
    'kun-signature'= >
 hash_hmac ('sha384', $ api_path. $ nonce.json_encode ($ DATA), $ secret_key),
];
$ Options= [
    'FORM_PARAMS'= >
 $ DATA,
    'Headers'= >
 $ Headers
    'http_errors'= >
 false
    //'debug'= >
 True
];
Print_R ($ Options);
//VAR_DUMP ($ Options);
$ response= $ client->
Request ('Post', $ API_PATH, $ Options);
$ result= $ response->
getbody () ->
getContents ();
Print_R ($ result);

Try example from afanasiev.top/kuna-api-v3-primer-zaprosa

Volodymyr Afanasiev2021-04-21 16:41:16