How to generate hmac sign in python 3 (icq auth)?

159 Views Asked by At

my code: http://pastebin.com/fuFxaxTT

and have link:

http://api.icq.net/aim/startSession?f=json&language=ru&events=mchat%2CuserAddedToBuddyList%2Chist%2CimState%2Cbuddylist&includePresenceFields=aimId%2Cfriendly%2Cstate%2Cssl&sessionTimeout=2592000&ts=1486941017&k=ic17mFHiwr52TKrx&a=%252FwQAAAAAAAGM2*****OTVCDd%252BSNbxZMzUDE0FKQ3Dc2MCVL8DpHgHX8z8%252BWEK3UI6LmhnP362bl%252FluMpxZB033a6qvxSmIkiCsY%253D&view=online&invisible=false&mobile=0&sig_sha256=gI93nv8lo0n9t3*****6uSH43fKnQzPL8Yo=

but have error:

{"response":{"statusCode":401, "statusText":"Authentication Required.  statusDetailCode 1014", "statusDetailCode":1014, "data":{"ts":1486941017}}}

i found example in nodejs - https://gist.github.com/foozzi/1382fce29b87bf2ea5544ca73a54a4d4#file-gistfile1-txt-L205 , but where error in my code?

1

There are 1 best solutions below

0
On

Maybe it's too late, but I've just successfully implemented session creation on C# and I can share some experience. According to ICQ desktop client source code they form URL signature a little different as below-

"POST&" + UrlEncode(url) + "&" + UrlEncode("param1=UrlEncode(value1)&param2=UrlEncode(value2)&...")

So I guess you missed url-encoding in some places.