I
I
ipsissimus2016-09-15 20:12:21
Classmates
ipsissimus, 2016-09-15 20:12:21

application not exist?

The task is to log in through Odnoklassniki, and use the received data later on the site
. The found PHP script is used for this

<?php
$AUTH['client_id'] = '1248204544';
$AUTH['client_secret'] = '*******************';
$AUTH['application_key'] = '**********************';
if (isset($_GET['code'])) {
  $curl = curl_init('http://api.odnoklassniki.ru/oauth/token.do');
  curl_setopt($curl, CURLOPT_POST, 1);
  curl_setopt($curl, CURLOPT_POSTFIELDS, 'code=' . $_GET['code'] . '&redirect_uri=' . urlencode($HOST . 'auth.php?name=odnoklassniki') . '&grant_type=authorization_code&client_id=' . $AUTH['client_id'] . '&client_secret=' . $AUTH['client_secret']);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  $s = curl_exec($curl);
  curl_close($curl);
  $auth = json_decode($s, true);
  $curl = curl_init('http://api.odnoklassniki.ru/fb.do?access_token=' . $auth['access_token'] . '&application_key=' . $AUTH['application_key'] . '&method=users.getCurrentUser&sig=' . md5('application_key=' . $AUTH['application_key'] . 'method=users.getCurrentUser' . md5($auth['access_token'] . $AUTH['client_secret'])));
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  $s = curl_exec($curl);
  curl_close($curl);
  $user = json_decode($s, true);

//* Печать данных в массиве
  echo "<pre>";
  print_r($user);
  echo "</pre>";
//* Печать данных в массиве


} else header('Location: http://www.odnoklassniki.ru/oauth/authorize?client_id=' . $AUTH['client_id'] . '&scope=VALUABLE_ACCESS&response_type=code&redirect_uri=https://www.aaa.com/okru');

However, after clicking on authorization, the following message flies out
Array
(
[error_code] => 101
[error_msg] => PARAM_API_KEY : Application not exist
[error_data] =>
)
Please help me figure out what's wrong? And what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-09-15
@ipsissimus

Judging by the error, the application_key is not correct

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question