T
T
therhino2015-03-07 13:33:56
Ruby on Rails
therhino, 2015-03-07 13:33:56

How to get an access_token from an address?

I use VKontakte authorization by sending the user to the following address
oauth.vk.com/authorize?client_id=xxxxx&redirect_uri=[REDIRECT_URI]&display=page&v=5.28&response_type=token , where REDIRECT_URI = localhost:3000/api/sessions/signin
After authorization, the contact redirects to the following address: localhost:3000/api/sessions/signin#access_token=xxxxxxx&expires_in=86400&user_id=xxxxxxx
How can I get an access_token from here in the controller?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Velichko, 2015-03-07
@therhino

You must change the response_type=token parameter to response_type=code in your request. After that, a request with the code parameter will come to the specified redirect_uri. Using this code, you can get an access_token by making a request from your server ("from the controller") to the VK server. Read more here .

V
Viktor Vsk, 2015-03-07
@viktorvsk

What are you doing there?
First, a meaningless question on Facebook, now it's not better on VKontakte.
What's wrong with omniauth ?

E
Evgeny Kolotilin, 2015-03-07
@iswitch

Instead of "Standalone/Mobile Apps", use "Third Party Sites and Widgets".
access_token from such a URL can only be obtained by an application that can create a browser window, i.e. mobile or desktop.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question