• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

  • Chevereto Support CLST

    Support response

    Support checklist

    • Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • Confirm that the server meets the System Requirements
    • Check for any available Hotfix - your issue could be already reported/fixed
    • Read documentation - It will be required to Debug and understand Errors for a faster support response

VK Auth don't work

Status
Not open for further replies.
I never got the dev update or anything about it. Do you know about?
 
Oh, I think I fixed it. Just adding API version to queries, like this

Code:
    public function api($method, array $query = array())
    {
        /* Generate query string from array */
        foreach ($query as $param => $value) {
            if (is_array($value)) {
                // implode values of each nested array with comma
                $query[$param] = implode(',', $value);
            }
        }
        $query['v'] = self::API_VERSION;
        $query['access_token'] = isset($this->accessToken['access_token'])
            ? $this->accessToken['access_token']
            : '';
        $url = 'https://api.vk.com/method/' . $method . '?' . http_build_query($query);
        $result = json_decode($this->curl($url), true);

        if (isset($result['response'])) {
            return $result['response'];
        }

        return $result;
    }
 
Please check this lines in route.connect.php (line 267)

Code:
$connect_user = [
    'id'        => $get_user['uid'],
    'username'    => G\sanitize_string(G\unaccent_string($get_user['first_name'] . $get_user['last_name']), true, true),
    'name'        => trim($get_user['first_name'] . ' ' . $get_user['last_name']),
    'avatar'    => $get_user['photo_200'],
    'url'        => 'http://vk.com/' . $get_user['domain'],
    'website'    => $get_user['site']
];

It's a part of VK auth. We get $get_user from API, but $get_user['uid'] is empty and auth will be incorrect. All correct fields from API response are here: https://vk.com/dev/users.get and here: https://vk.com/dev/objects/user
I change it to fix this bug:

Code:
'id' => isset($get_user['id'])? $get_user['id'] : $get_user['uid'],
 
Last edited:
Thanks, your patch fixes this issue. I will add it to the next revision.
 
Status
Not open for further replies.
Back
Top