androidandroid-intentvk

Android VKontake official client. How to get authorized


I have on my device official App from VKontakte.

And I authorized there.

I try write own app which use VKontake API, but I need authorize.

Does there exist any way to get authorized status of user from official application with sending Intent with some action?


Solution

  • Now is it possible! Please look through this tutorial http://vk.com/dev/android_sdk

    Also you can authorize via webview Authorization in Vkontakte is an OAuth authorization. So following steps are similar for all services which use OAuth: Facebook, Instagram and etc.

    1. Create application on vk.com: http://vk.com/editapp?act=create
    2. Get it's ID.
    3. In your login Activity open a webview with login url https://oauth.vk.com/authorize?client_id=APP_ID&scope=SETTINGS&redirect_uri=REDIRECT_URI&display=DISPLAY&response_type=token

    APP_ID is ID of your application. You will find it in VK -> Applications -> Settings -> Applications I manage (at the bottom) -> Manage

    This login url will show a standard VK authorization dialog. There user will enter his login and password.

    After that the user will be redirected to your Redirect-Uri. So you need to prepare a Redirect_Uri - that's a page which will be opened after successful login.

    To that url will be concatenated an access_token. Access_token is the only parameter you need to store after the authorization. In next requests you'll just need to provide the access_token.

    About other parameters you can read in VK site: http://vk.com/developers.php?oid=-17680044&p=Authorizing_Client_Applications