Last active
June 16, 2020 17:33
-
-
Save dinkydani/b9b534ce00186436442b5a5996ee87dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const receiveMessage = event => { | |
// Do we trust the sender of this message? (might be | |
// different from what we originally opened, for example). | |
if (event.origin !== BASE_URL) { | |
return; | |
} | |
const { data } = event; | |
// if we trust the sender and the source is our popup | |
if (data.source === 'lma-login-redirect') { | |
// get the URL params and redirect to our server to use Passport to auth/login | |
const { payload } = data; | |
const redirectUrl = `/auth/google/login${payload}`; | |
window.location.pathname = redirectUrl; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment