How to use Codeforces API to compose a request to use a person api key to authenticate that request.
I keep on getting the error : "You have to be authenticated to use this method".
Eg: "{u'status': u'FAILED', u'comment': u'apiKey: Incorrect signature;onlyOnline: You have to be authenticated to use this method'}"
if there anyone can help or give me an exapmle of request ?
You can read the documentation about authorization here...
i readey read it but i cant understand the example in the doc i need another one if u can give me an example this will be useful to me
this my get request can u till me whats a problem here
https://mirror.codeforces.com/api/contest.hacks?contestId=566&apiKey=0df9bea02d625273ee46121789a8ad208e957950&time={{currentdate}}&apiSig=123456#sha512Hex(123456/contest.hacks?apiKey=0df9bea02d625273ee46121789a8ad208e957950&contestId=566&time=1645028198#6bdd9677e7b082f143f541f981857e8b84b96e83)
Thanks for posting your api key ;))
Do you actually calculate the sha512 hash or are you literally typing the words "sha512Hex" into the address?
i used site to calculate and i put it like that https://mirror.codeforces.com/api/contest.hacks?contestId=566&apiKey=0df9bea02d625273ee46121789a8ad208e957950&time={{currentdate}}&apiSig=123456#5fcd23b1764dd55137604fcd84e53809e02356e27960e7e83f3cc88bf665f2b320031434ac7f151e22e6cc6a591766035ed4b5b279148d5d373f479a3dcc12e5
its give me the same error whats wrong here ?
I wrote a friend 's visualiser through javascript which was on a similar line as yours, so I guess it would be enough for you to understand what' s wrong with your way of handling it.
var APIkey = document.getElementById("ak").value;
var secret = document.getElementById("skey").value;
var code = "936854/user.friends?apiKey=" + APIkey + "&onlyOnline=false&time=" + time + "#" + secret;
code = SHA512(code); //Convert to SHA hash
//time: time in unix format, remember to have it at max less than 5 minutes only
var base_url = "https://mirror.codeforces.com/api/user.friends?apiKey=" + APIkey + "&onlyOnline=false&time=" + time + "&apiSig=936854" + code;
nice api