Search code examples
javascriptauthenticationgmail

Gmail Authentication redirection


I want to know how basically social one-click authentication works.For example, in Gmail Authentication when i click a button in my page a new window is opened from my tab which lists gmailIds.The user selects their respective emailId and gives permission.How do that tab post data to my existing tab opened?Also, if there are multiple tabs opened of same domain how Gmail authentication window post success data to my promise in javascript.


Solution

  • A window/tab that has opened another window/tab can communicate with the child tab via the window.opener API

    Additionally if you're able to write javascript on both tabs you can use the window.postMessage API