Code Monkey home page Code Monkey logo

Comments (8)

7even avatar 7even commented on August 28, 2024

AFAIK you need to pass your app_secret as an additional parameter when calling secure methods. Something like this should work:

VkontakteApi::Client.new(vk_token).secure.getSMS(uid: 41526347, client_secret: Vkontakte.app_secret)

from vkontakte_api.

rromanchuk avatar rromanchuk commented on August 28, 2024

I'm getting closer. My guess is something messed up with my scopes, although I verified that i am asking for the "notify" scope. Maybe i'm using an old token? Looks like there is a lot of chatter about this method on google, but hard for me to parse with my shitty russian.

[3] pry(main)> u.vk_client.secure.getSMS(uid: 41526347, client_secret: VkontakteApi.app_secret)
VkontakteApi::Error: VKontakte returned an error 5: 'User authorization failed: server method is unavailable with user token.' after calling method 'secure.getSMS' with parameters {"uid"=>"41526347", "client_secret"=>"blah"}.

from vkontakte_api.

rromanchuk avatar rromanchuk commented on August 28, 2024

ahhh, maybe this is what i need http://vk.com/developers.php?oid=-17680044&p=Application_Server_Authorization

from vkontakte_api.

7even avatar 7even commented on August 28, 2024

Yes, you are trying to call secure methods with a token you got from a usual server authorization, but secure methods require an application server authorization.

Try this instead:

vk = VkontakteApi.authorize(type: :app_server)
vk.secure.getSMS(uid: 41526347, client_secret: VkontakteApi.app_secret)

from vkontakte_api.

rromanchuk avatar rromanchuk commented on August 28, 2024

Getting closer, but it looks like this method is causing problems for a lot of developers
http://vk.com/topic-12254722_22166247

VkontakteApi.authorize(type: :app_server).secure.sendSMSNotification(client_secret: VkontakteApi.app_secret, uid: 41526347, message: "test")
VkontakteApi::Error: VKontakte returned an error 1: 'Unknown error occured' after calling method 'secure.sendSMSNotification' with parameters {"client_secret"=>"blah", "uid"=>"41526347", "message"=>"test"}.

from vkontakte_api.

7even avatar 7even commented on August 28, 2024

It is a different method (topic is about secure.sendNotification and you need secure.sendSMSNotification). I don't really see what's causing the problem here unfortunately.

from vkontakte_api.

rromanchuk avatar rromanchuk commented on August 28, 2024

doh, i'm going to fork your https://github.com/7even/vkontakte_on_rails example and try adding a secure.sendSMS as a sanity check. I have a feeling it's a configuration error

from vkontakte_api.

7even avatar 7even commented on August 28, 2024

Did you manage to find something out?

from vkontakte_api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.