Platform
Sign Up With VKontakte
10 min
sign in with vk (vkontakte) tutorial introduction sign in with vk (vkontakte) enables users to sign in to apps using their vk accounts prerequisites to complete this tutorial, you will need an app created at back4app see the create new app tutorial to learn how to create an app at back4app set up a subdomain for your back4app app see activating your web hosting and live query to learn how to create a subdomain in back4app a vk account 1 create a new back4app app first of all, it’s necessary to make sure that you have an existing app created at back4app however, if you are a new user, you can check this tutorial https //www back4app com/docs/get started/new parse app to learn how to create one 2 create a new vk app create a new vk application by going to vk developers https //vk com/apps?act=manage and clicking the create app button fill up the title and choose the platform as standalone app, then click the connect app button choose a category for your app and, if applicable, a type of leaderboard, and community click save under the settings tab of your vk application, you will find your app id, secure key, and service token among other useful info fill up your website address and the base domain for it save it 3 retrieve your code copy the app id from your to use as the your client id and use your website address as your redirect uri , and choose a scope https //vk com/dev/permissions to use in your scope from the available options then visit the following url changing the parameters above it will ask you to log in to vk alternatively, you can use the following curl command to retrieve your token curl x post \\ f \\'client id=your client id' f 'scope=your scope' f 'redirect uri=your redirect uri' f 'response type=token' https //oauth vk com/authorize? run it and you should retrieve your access token remember the code can be used only once if you get an error or don’t use your token, you must re generate your code to be able to run it again 4 configure your back4app app in your back4app app, go to server settings and open the vkontakte login box fill up your application id and vkontakte application secret save it 5 start the development now that the sign in with vk is configured, you can start the development process the format for authdata is { "vkontakte" { "id" "user's vkontakte id (string)", "access token" "an authorized vkontakte access token for the user" } } here is the method for the ios sdk 1 pfuser loginwithauthtype(inbackground "vkontakte", authdata \["access token"\ tokenstring, "id" user]) continuewith { task > any? in 2 3 } and here for the android sdk 1 map\<string, string, bool> authdata = new hashmap\<string, string, bool>(); 2 authdata put("access token", tokenstring); 3 authdata put("id", user); 4 parseuser loginwithinbackground("vkontakte", authdata){ 5 6 }