Great. I noticed an interesting trick that Google recommends: a callback url will have <script type="text/javascript">window.close();</ script> And that's all!
So basically when Twitter redirects to the callback url, the html in that callback will just close that popup and do nothing else. Then the parent window will check to see if popup window has been closed (maybe using the interval timer) and if it detects that popup has been closed, it will then issue another ajax request to get the user data from the server. The user data would then be avialable in the same SESSION because the callback url, before sending out the html, will add user's data to session. This is simple, I've seen this on one of the Twitter-based website. for some reason I was going to do it differently: I was going to have the callback url to send json object to the popup window and then from that popup window call the window.opener.login(o) That would pass the user data (contents of 'o') back to the parent window (the one that opened the popup) The o is that json object. The opener window would then close the popup window. This may be more efficient because you don't need that extra ajax call from the main parent window. Not sure if this is a good solution because I'm not sure if it works with all browsers. I guess I just have to try it. On Feb 14, 1:25 pm, Abraham Williams <[email protected]> wrote: > Have a look at this > document:http://wiki.opensocial.org/index.php?title=OAuth_Popup > > Abraham > > > > On Sat, Feb 13, 2010 at 05:51, Dmitri Snytkine <[email protected]> wrote: > > Hello!. > > > I am looking for an example of implementation of login with Twitter > > where when user clicks on the login with Twitter, > > the Twitter's "Allow/Deny" page is opened in a small popup window, > > then after user has authorized the login, that small window passes the > > data to the parent window (I think it's called windows.opener in > > javascript) and then the popup closes > > > I've seen this setup on several sites and I like it much more than > > just using the same window to redirect to login screen then back to > > the callback url > > > Does anymore know if a tutorial or example exists for doing this? > > -- > Abraham Williams | Community Advocate |http://abrah.am > Project | Out Loud |http://outloud.labs.poseurtech.com > This email is: [ ] shareable [x] ask first [ ] private. > Sent from Seattle, WA, United States
