Answer the question
In order to leave comments, you need to log in
How to get data from a child window when redirecting?
To authorize oauth in my vuejs application, I open a child window, for example:
let vk_window = window.open(endpoint)
let redirect_uri = new RegExp(auth.settings.redirect_uri)
let watch_timer = setInterval(() => {
try {
let vk_location = vk_window.location
if (redirect_uri.test(vk_location)) {
clearInterval(watch_timer)
let data = vk_window.location.hash.substring(1).split('&')
//парсим data
//устанавливаем токен
//аутентифицируем
vk_window.close()
}
} catch (error) {
throw error
}
}, 500)
Answer the question
In order to leave comments, you need to log in
There is a redirect uri parameter in the vk-App settings - you need to return html from it with a script that sends authorization data to the parent window via postMessage
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question