Bitcoin Forum
May 14, 2024, 12:24:19 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: problem with nova api  (Read 614 times)
gargouri20011 (OP)
Member
**
Offline Offline

Activity: 71
Merit: 10


View Profile
September 12, 2017, 12:12:21 AM
Last edit: September 12, 2017, 11:18:35 AM by gargouri20011
 #1

Hello
I am stuck in Auth failed when i try to use nova private API .
Here is the code :

/////////////////////////////////////////
$api_key = "xxxxxxxxxxxxxxxxxxxxxx" ;
$api_secret = "xxxxxxxxxxxxxxxxxxxxxx" ;

$t = time ();

$url = "https://novaexchange.com/remote/v2/private/" . "tradehistory" . "/?nonce=" . $t ;

$signature = hash_hmac ( 'sha512' , $url , $api_secret , true );


$ch = curl_init ();
$curlConfig = array(
CURLOPT_URL => "https://novaexchange.com/remote/v2/private/tradehistory" . "/?nonce=" . $t ,
CURLOPT_POST => true ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_SSL_VERIFYPEER => false ,
CURLOPT_POSTFIELDS => array(
'apikey' => $api_key ,
'signature' => $signature ,
)
);
curl_setopt_array ( $ch , $curlConfig );
$result = curl_exec ( $ch );


curl_close ( $ch );

echo $result ;
output === > {"status": "error", "message": "Auth failed"}
///////////////////////////////////////////

any idea what is wrong here ?
1715646259
Hero Member
*
Offline Offline

Posts: 1715646259

View Profile Personal Message (Offline)

Ignore
1715646259
Reply with quote  #2

1715646259
Report to moderator
1715646259
Hero Member
*
Offline Offline

Posts: 1715646259

View Profile Personal Message (Offline)

Ignore
1715646259
Reply with quote  #2

1715646259
Report to moderator
The Bitcoin software, network, and concept is called "Bitcoin" with a capitalized "B". Bitcoin currency units are called "bitcoins" with a lowercase "b" -- this is often abbreviated BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715646259
Hero Member
*
Offline Offline

Posts: 1715646259

View Profile Personal Message (Offline)

Ignore
1715646259
Reply with quote  #2

1715646259
Report to moderator
ferumflex
Full Member
***
Offline Offline

Activity: 256
Merit: 102


View Profile WWW
September 12, 2017, 08:41:46 AM
 #2

And what is result of the executing this script? It can be anything, please provide more description
gargouri20011 (OP)
Member
**
Offline Offline

Activity: 71
Merit: 10


View Profile
September 12, 2017, 11:18:14 AM
 #3

Hello
{"status": "error", "message": "Auth failed"}
BrewMaster
Legendary
*
Offline Offline

Activity: 2114
Merit: 1292


There is trouble abrewing


View Profile
September 12, 2017, 02:24:23 PM
 #4

i don't understand this language that you are using but i have had the same issue with Novaexchange API too.
i see two things here:
1. i post to what you are calling "url" here not to "CURLOPT_URL"
2. your signature must be in base64!

#2 was my issue too. usually i convert the signature to hex or just the same bytes and post it, but with Nova you have to convert your HmacSha512 result into base64 and post that!

There is a FOMO brewing...
chicobr
Full Member
***
Offline Offline

Activity: 235
Merit: 250



View Profile
September 12, 2017, 04:04:10 PM
 #5

maybe their server have some problem. Many people complain about register and ticket system last week. Some hacker try to ddos them
gargouri20011 (OP)
Member
**
Offline Offline

Activity: 71
Merit: 10


View Profile
September 12, 2017, 10:48:16 PM
 #6

i don't understand this language that you are using but i have had the same issue with Novaexchange API too.
i see two things here:
1. i post to what you are calling "url" here not to "CURLOPT_URL"
2. your signature must be in base64!

#2 was my issue too. usually i convert the signature to hex or just the same bytes and post it, but with Nova you have to convert your HmacSha512 result into base64 and post that!

hello

i did :
$signature = base64_encode(basehash_hmac ( 'sha512' , $url , $api_secret )); //convert HmacSha512 to base64



Still same error {"status": "error", "message": "Auth failed"}
ferumflex
Full Member
***
Offline Offline

Activity: 256
Merit: 102


View Profile WWW
September 14, 2017, 08:41:42 AM
 #7

I was able find example on python https://novaexchange.com/remote/faq/
You need to add headers property maybe this helps.
gargouri20011 (OP)
Member
**
Offline Offline

Activity: 71
Merit: 10


View Profile
September 15, 2017, 10:37:42 PM
 #8

Hello
 $headers = array('content-type: application/x-www-form-urlencoded');
still same
block {"status": "error", "message": "Auth failed"}"  Embarrassed
Patatas
Legendary
*
Offline Offline

Activity: 1750
Merit: 1115

Providing AI/ChatGpt Services - PM!


View Profile
September 15, 2017, 10:46:26 PM
 #9

Hello
 $headers = array('content-type: application/x-www-form-urlencoded');
still same
block {"status": "error", "message": "Auth failed"}"  Embarrassed
1.Please edit your code in a nice code-block provided.
2.What do you see on the console ?
3.Have you used Post-Man for the analysis ?
4.Check if the error code is 405 in the response or your requests are going as options.
4.Headers might be needs to send along with the request to allow access.I can help you if you format the code nicely and figure out what exactly the problem is.
gargouri20011 (OP)
Member
**
Offline Offline

Activity: 71
Merit: 10


View Profile
September 16, 2017, 06:05:44 PM
 #10

thank for reply ,
i tried all:  empty header , header as content-type: application/x-www-form-urlencoded and header with key and secret key ($headers = array('Sign: '.$sign,'Key: '.$key,)Wink

Still same result

2) i am using php so i can see what is the output , that's all output i am getting .
3)no
3)according to header request is 200

4)would be g8
grixxby
Member
**
Offline Offline

Activity: 139
Merit: 10


View Profile
October 01, 2017, 09:09:01 PM
 #11

Hi gargouri20011

I think your problem lies in the way you create the signature.

Try changing
$signature = base64_encode(hash_hmac ( 'sha512' , $url , $api_secret ));

To :
$signature = base64_encode(hash_hmac('sha512', $url, $api_secret, true));

The last parameter of hash_mac needs to be true. If not specified, it's false by default and results in lowercase hexits instead of raw binary data.

Hope that helps Smiley
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!