J
J
julia-finance2017-04-21 22:49:03
API
julia-finance, 2017-04-21 22:49:03

The Odnoklassniki API for the Wordpress site does not work, what should I do?

For some reason, the Odnoklassniki API for the Wordpress site (Wordpress Social Login plugin) does not work, all settings are made, when you click authorization through Odnoklassniki, it gives an error - Odnoklassniki reject the request. If you change the redirect link, it simply writes - the link is not set in the settings.
This is what the plugin outputs:
Request failed. Either you have cancelled the authentication or Odnoklassniki refused the connection.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
RomanKlsnk, 2017-10-30
@RomanKlsnk

Faced the same problem, I had WordPress 4.8.2 with Wordpress Social Login 2.3.3
At the moment, the Odnoklassniki handler is outdated, their API has been updated + additional is used. authorization key (in the letter it is "Application Public Key"). Here's what helped me:

  • In the "Application Secret" field for Odnoklassniki in the Social Login plugin, set the "Application Secret Key" from the letter from Odnoklassniki about registering the application
  • Next, you will have to edit the OK handler in the plugin, this is actually bad, but this is the fastest way to solve the problem (for good, make an edit on GitHub):
    • open the file "/wp-content/plugins/wordpress-social-login/hybridauth/Hybrid/Providers/Odnoklassniki.php" for editing
    • in the "initialize()" function, you need to change the access point URLs, the final form of the function:
      function initialize() 
        {
          parent::initialize();
      
          // Provider apis end-points
          $this->api->api_base_url    = "https://api.ok.ru/fb.do";
          $this->api->authorize_url   = "https://connect.ok.ru/oauth/authorize";
          $this->api->token_url       = "https://api.ok.ru/oauth/token.do"; 
          $this->api->sign_token_name = "access_token";
        }

    • after making these edits, authentication should work, but the data selection will not work
    • further, in the function "getUserProfile()" it is necessary to set the correct value for the public key, at the moment it is taken with the variable "$this->config['keys']['key']", for this, at the beginning of the function, you can write that something like:
      function getUserProfile()
        {
          $this->config['keys']['key'] = '<Публичный ключ приложения>';
          $sig = md5('application_key=' . $this->config['keys']['key'] . 'method=users.getCurrentUser' . md5($this->api->access_token . $this->api->client_secret));
          $response = $this->api->api( '?application_key=' . $this->config['keys']['key'] . '&method=users.getCurrentUser&sig=' .$sig); 
          ...
        }

      instead of "<Application public key>" enter your value

N
neko66, 2017-05-31
@neko66

julia-finance found a solution?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question