mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
auth: login through vk iframe
This commit is contained in:
parent
28dc2bec8b
commit
75505656df
6 changed files with 39 additions and 7 deletions
|
@ -152,10 +152,16 @@ function* mapInitSaga() {
|
|||
function* authCheckSaga() {
|
||||
const { id, token } = yield select(getUser);
|
||||
|
||||
if (window.location.search) {
|
||||
const { viewer_id, access_token, auth_key } = yield parseQuery(window.location.search);
|
||||
if (viewer_id && access_token && auth_key) {
|
||||
const user = yield call(checkIframeToken, { viewer_id, access_token, auth_key });
|
||||
if (window.location.search || true) {
|
||||
const { viewer_id, auth_key } = yield parseQuery(window.location.search);
|
||||
// https://alpha-map.vault48.org:3000/auth/iframe/vk?viewer_id=360004&access_token=e558a05d5cb1fcb195316703a2d5e5ec9d19b2c608844c986ec56798f8ac642379bb37fbc58270435e077&auth_key=b0ff47f659d21b6b880a1eee60b6e794
|
||||
// const viewer_id = '360004';
|
||||
// const auth_key = 'b0ff47f659d21b6b880a1eee60b6e794';
|
||||
|
||||
// console.log('Already logged in?', viewer_id, auth_key, id !== `vk:${viewer_id}`);
|
||||
|
||||
if (viewer_id && auth_key && id !== `vk:${viewer_id}`) {
|
||||
const user = yield call(checkIframeToken, { viewer_id, auth_key });
|
||||
|
||||
if (user) {
|
||||
yield put(setUser(user));
|
||||
|
|
|
@ -33,6 +33,6 @@ export const postMap = ({
|
|||
distance,
|
||||
}).then(result => (result && result.data && result.data));
|
||||
|
||||
export const checkIframeToken = ({ viewer_id, access_token, auth_key }) => axios.get(API.IFRAME_LOGIN_VK, {
|
||||
params: { viewer_id, access_token, auth_key }
|
||||
}).then(result => (result && result.data));
|
||||
export const checkIframeToken = ({ viewer_id, auth_key }) => axios.get(API.IFRAME_LOGIN_VK, {
|
||||
params: { viewer_id, auth_key }
|
||||
}).then(result => (result && result.data && result.data.success && result.data.user)).catch(() => (false));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue