Answer the question
In order to leave comments, you need to log in
How to add fields for classmates?
I write standard code
$sign = md5("application_key={$public_key}format=jsonmethod=users.getCurrentUser" . md5("{$tokenInfo['access_token']}{$client_secret}"));
$params = array(
'method' => 'users.getCurrentUser',
'access_token' => $tokenInfo['access_token'],
'application_key' => $public_key,
'format' => 'json',
'sig' = > $sign
);
$userInfo = json_decode(file_get_contents(' api.odnoklassniki.ru/fb.do ' . '?' . urldecode(http_build_query($params))), true);
if (isset($userInfo['uid'
])) { $result = true;
}
How to add fields to the getCurrentUser method?
Tried like this
$sign = md5("application_key={$public_key}format=jsonfields=email,uidmethod=users.getCurrentUser" . md5("{$tokenInfo['access_token']}{$client_secret}"));
$params = array(
'method' => 'users.getCurrentUser',
'access_token' => $tokenInfo['access_token'],
'application_key' => $public_key,
'format' => 'json',
'fields' = > 'email,uid',
'sig' => $sign
);
$userInfo = json_decode(file_get_contents(' api.odnoklassniki.ru/fb. do ' . '?' . urldecode(http_build_query($params))), true);
if (isset($userInfo['uid'])) {
$result = true;
}
Gives an error that $sign is invalid: PARAM_SIGNATURE : Invalid signature
How to add fields?
Answer the question
In order to leave comments, you need to log in
Solution found!
for sign you need to write
$sign = md5("application_key={$this->params['public_key']}fields=email,first_name,last_name,birthdayformat=jsonmethod=users.getCurrentUser" . md5("{$tokenResponse[ 'access_token']}{$this->client_secret}"));
The order is such that after the application_key you need to immediately write the fields
But here it doesn’t matter how to enter, the order is not needed:
$params = array(
'method' => 'users.getCurrentUser',
'access_token' => $tokenInfo['access_token'] ,
'application_key' => $public_key,
'format' => 'json',
'fields' => 'email,first_name,last_name,birthday',
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question