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 C. 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
calendar.

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(“https://www.google.com/calendar/render”). 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.
http://code.google.com/apis/calendar/docs/2.0/developers_guide_protocol.html

On Nov 27, 5:58 pm, kevin lee [email protected]

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 C. the way many other similar applications, such as
Zvents, do, which is direct user to Google C. account login page,
wait for user to login, and keep Google C. open in order to save
the event. These apps link to Google C. with a url that looks
like this: https://www.google.com/accounts/ServiceLogin?service… 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:

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 C. the way many other similar applications, such as
Zvents, do, which is direct user to Google C. account login page,
wait for user to login, and keep Google C. open in order to save
the event. These apps link to Google C. with a url that looks
like this: https://www.google.com/accounts/ServiceLogin?service… 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!

Thank you very much for the big hint!