How to wait and check for login to an external site

Hi I am working on a event calendar app that I would like a user to be
able to save an event they selected to an online calendar such as Google
Calendar. I have a link to Google Calendar a user can click to open it
in a new tab once the user selected an event. I don't need to save user
email info so the best approach I think is to wait for the user to log
into the Google app and then my code adds the selected event into the

I guess I need to have a loop (with a timeout) in an action checking to
see if the user has logged in. My idea is to try to get the url of the
logged in page using Mechanize like this: page =
agent.get(""). This is perhaps a
dumb idea. Or do I really need to capture the login event somehow.

What should I do to accomplish this goal? What tool (gem) I should use
to do this? Please put me on the right track with some guidelines or
link to resources, thanks!

check out the google calendar API docs, instead of using mechanize and
scraping the page.

Thank you very much for the big hint!

I was able to use AuthSub to retrieve a token from Google but it
redirect back to my app and closed the Google webpage. This is not
exactly what I want to do. What I actually want to do is to interact
with Google Calendar the way many other similar applications, such as
Zvents, do, which is direct user to Google Calendar account login page,
wait for user to login, and keep Google Calendar open in order to save
the event. These apps link to Google Calendar with a url that looks
like this:… I
have not been able to find any reference to this url in the Google
Account Authentication API. Any idea where is it covered in the
document or this is something else entirely? Or that I simply need to
dig deeper into AuthSub to achieve my goal? I would again appreciate
any guidance. Thanks!

How do I process the Google token received by using AuthSub after it is
passed to my controller (I don't have an index action but map.connect
defaults to index) because I make the request to Google from the main
page of my app? Is it possible? Or must I make a request inside an
action? Thanks!

kevin lee wrote: