N
N
neoneel2018-04-10 11:25:56
JavaScript
neoneel, 2018-04-10 11:25:56

What are the methods of authorization through vk/fb/twitter?

Explain the situation, please.
In order to get a token, you need to go through authorization, authorization takes place on the server side of the social network, then you get a get link with a token (this is about VK, with client authorization), but it's not safe to pull a token from the client side and then drag it to your server for requests to the social network api, then server authorization is needed.
Using, say, vksdk for node js, you can in principle get a token, but as I understand it, it will be valid for the application and not for the user, because the following code is used to get it:

// Setup
var VK = require('vksdk');
var vk = new VK({
   'appId'     : 2807970,
   'appSecret' : 'L14ZKpgQPalJdumI6vFK',
   'language'  : 'ru'
});

/**
 * Request server methods
 */

// Setup server access token for server API methods
vk.on('serverTokenReady', function(_o) {
    // Here will be server access token
    vk.setToken(_o.access_token);
});

It turns out that we stupidly authorized the application, not the user.
So the question is, what are the ways of authorization and obtaining a token for social networks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
eternalfire, 2018-04-10
@neoneel

Passport.js
www.passportjs.org/docs
example strategy for authorization using VK
https://github.com/stevebest/passport-vkontakte#readme

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question