mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
backend: added https/http detection at vk.js
This commit is contained in:
parent
344d8df1f8
commit
89a64e244d
1 changed files with 2 additions and 1 deletions
|
@ -7,6 +7,7 @@ const { CONFIG } = require('../../../../config/backend');
|
||||||
const fetchUserData = async (req, res) => {
|
const fetchUserData = async (req, res) => {
|
||||||
const { query: { code } } = req;
|
const { query: { code } } = req;
|
||||||
const host = req.get('host');
|
const host = req.get('host');
|
||||||
|
const proto = req.connection.encrypted ? 'https' : 'http';
|
||||||
|
|
||||||
const { data: { access_token, user_id } } = await axios.get(
|
const { data: { access_token, user_id } } = await axios.get(
|
||||||
'https://oauth.vk.com/access_token',
|
'https://oauth.vk.com/access_token',
|
||||||
|
@ -15,7 +16,7 @@ const fetchUserData = async (req, res) => {
|
||||||
client_id: CONFIG.SOCIAL.VK.APP_ID,
|
client_id: CONFIG.SOCIAL.VK.APP_ID,
|
||||||
client_secret: CONFIG.SOCIAL.VK.SECRET,
|
client_secret: CONFIG.SOCIAL.VK.SECRET,
|
||||||
code,
|
code,
|
||||||
redirect_uri: `http://${host}/auth/social/vk`,
|
redirect_uri: `${proto}://${host}/auth/social/vk`,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
).catch(err => {
|
).catch(err => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue