Error with adding Google SSO to mobile application Answered
Hi Tyler Bell
We are trying to add Google SSO to our mobile application using memberstack, but looks like it send the user data to the opener tab here https://client.memberstack.com/auth/callback?state=
using this script
https://client.memberstack.com/auth/callback?state=
const error = JSON.parse('{"message":"Something went wrong. Please try again."}');
if (error) {
window.opener.postMessage({ error }, "*");
} else {
const data = JSON.parse(unescape('[object Object]'))
window.opener.postMessage({ data }, "*");
}
window.close();
Is there any chances to don’t open a new tab and send the data to a parent mobile application?
For example:
window.ReactNativeWebView.postMessage for React Native, and
window.webkit.messageHandlers.cordova_iab.postMessage for Cordova
Thanks in advance
Comments
1 comment
I resolved this by making modifications to the memberstack/dom lib
Create a browser listener to get that message and parse the html to get the success (token) or error (error message)
Success:
Error:
That's all, hope this helps
Please sign in to leave a comment.