Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typeerror: cannot read property '0' of undefined #20

Open
ivklgn opened this issue Apr 30, 2018 · 0 comments
Open

typeerror: cannot read property '0' of undefined #20

ivklgn opened this issue Apr 30, 2018 · 0 comments

Comments

@ivklgn
Copy link

ivklgn commented Apr 30, 2018

Package not compatible with vk API version 3.
I had the following problem with mrt:accounts-vk. When I called Meteor.loginWithVk i received next error:
Typeerror: cannot read property '0' of undefined.

This propblem associated with VK api version in getIdentity(accessToken) request.
Steps for solve problem:

  1. In your meteor project create directory for local packages
  2. Clone https://github.com/alexpods/meteor-accounts-vk in <your_meteor_app>/packages
  3. Rename package in this file: <your_meteor_app>/packages/meteor-accounts-vk/package.js
    for example:
Package.describe({
    summary: "Login service for VKontakte accounts (https://vk.com)",
    version: "0.2.0",
    git: "https://github.com/alexpods/meteor-accounts-vk",
    name: "mrt:accounts-vk2" // FIX NAME THERE
});
  1. Install your local package locally. meteor add mrt:accounts-vk2 for prev example
  2. Fix VK API version in getIdentity (<your_meteor_app>/packages/meteor-accounts-vk/lib/vk_server.js)
    Fixed example:
...
var getIdentity = function (accessToken) {
    var result = HTTP.get(
        "https://api.vk.com/method/users.get", {params: {
            v: '3', // API VERSION
            access_token: accessToken,
            fields: 'uid, nickname, first_name, last_name, sex, bdate, timezone, photo, photo_big, city, country'
        }});
...

this is work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant