V
V
Valeriu Vodnicear2016-03-16 02:09:55
PHP
Valeriu Vodnicear, 2016-03-16 02:09:55

How to generate sig parameter for external sites working with Odnoklassniki API?

Odnoklaanikov API swears at my "sig" parameter.
Someone faced such a problem?
The method I want to use is "friends.get".
Here is how I tried to generate this parameter.

$sig = md5("application_key={$app['key']}format=jsonmethod=friends.get" . md5("{$token['access_token']}{$app['secretKey']}"));

Here is the response returned:
[error_code] => 104
[error_msg] => PARAM_SIGNATURE : Invalid signature 3de87d239a55e1adb910c11d0fb8273c, calculated by string application_key=CBAKALELEBABABABAuid=513071848033********SECRET KEY*******

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrzej Wielski, 2016-03-16
@vodnicear

This is clearly stated in the official documentation. Specifically, in the Authentication and Authorization section.

The array is sorted alphabetically by key
. All key/value pairs are concatenated in key=value format (skipping the access_token and sig parameters).
The session_secret_key (if present) or the application secret key (if session_secret_key is missing) is appended.
The md5 hash of the entire string is taken (the string must not be in the URL-encode format, the encoding must be UTF-8).
The result is converted to lower case.

D
darkmood, 2021-08-22
@darkmood

Example for python:
https://github.com/OlegShir/Ok_api_publish_post/bl...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question