N
N
nabokovsafran2014-08-09 16:27:01
Android
nabokovsafran, 2014-08-09 16:27:01

VK API. Android. How to get access_token?

Hello.
I make a request like this:

Uri authUri = Uri.parse("https://oauth.vk.com/authorize?client_id=*******&scope=friends,messages&redirect_uri=https://oauth.vk.com/blank.html&display=mobile&v=5.24&response_type=token");

Intent auth = new Intent( Intent.ACTION_VIEW, authUri );
startActivity(auth);

The browser opens, permissions are requested, everything is as it should be. After confirmation, the user is redirected to the redirect_uri and the access_token is indicated in the address bar.
How to get the access_token from the address bar and pass it back to my application for further work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alternativshik, 2014-08-09
@nabokovsafran

I don’t know how in android, but in the general case, you need to run not a browser, but an embedded webview component, in which, just after a redirect to blank.html, you can take data from the url and then parse it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question