1) Set the OAuth callback to a URL that's still on your domain,
something specific that's purpose is only to collect the callback
details and quickly return a 200 status.
2) In your parent window, occasionally poll the status of the child
window -- when it's on Twitter.com you won't have access to its
window.location.
3) When the window.location is on your callback URL and the same
domain as the parent window, you'll be able to close the pop-up window
and then change the state of the originating window in turn.
Taylor Singletary
Developer Advocate, Twitter
http://twitter.com/episod
In your pop up, when Twitter redirects to your callback URL:
- process the Oauth tokens etc so that your user's session is authenticated
- set the parents window location to whereever it needs to go (logged in
view of your app), using window.opener.location.href = "whatever"
- close the popup (window.close)
On 3/15/10 5:58 AM, "Taylor Singletary" <taylorsi...@twitter.com>
wrote:
On Mar 15, 1:35 pm, Michael Steuer <mste...@gmail.com> wrote:
> There's better ways of doing this actually, that doesn't require polling of
> any kind...
>
> In your pop up, when Twitter redirects to your callback URL:
>
> - process the Oauth tokens etc so that your user's session is authenticated
> - set the parents window location to whereever it needs to go (logged in
> view of your app), using window.opener.location.href = "whatever"
> - close the popup (window.close)
>
> On 3/15/10 5:58 AM, "Taylor Singletary" <taylorsinglet...@twitter.com>
> wrote:
>
> > You can't accomplish it exactly the way you want to, but you can do this:
>
> > 1) Set the OAuth callback to a URL that's still on your domain,
> > something specific that's purpose is only to collect the callback
> > details and quickly return a 200 status.
> > 2) In your parent window, occasionally poll the status of the child
> > window -- when it's on Twitter.com you won't have access to its
> > window.location.
> > 3) When the window.location is on your callback URL and the same
> > domain as the parent window, you'll be able to close the pop-up window
> > and then change the state of the originating window in turn.
>
> > Taylor Singletary
> > Developer Advocate, Twitter
> >http://twitter.com/episod
>
I would presume you can simply output javascript to the client, and it will
get executed. So in your mark up that your servlet renders, simply add a
<script type="text/javascript"> element containing the javascript that
refreshes the location of the window.opener window and subsequently closes
the child window..