Thursday 8 June 2017

Google oauth authentication in google scripts addon using AngularJS and ExpressJS, Passport

I am working on a google script add-on for google docs. I'm using angular for the front-end (add-on page) and I need to connect to my node/express/passport api to login/register the user with google oauth.

My backend implementation is similar to the example given in the usage section here: https://github.com/jaredhanson/passport-google-oauth2

My first attempt was to add a link to the add-on page that points to my /auth/google endpoint. This opens a new tab and takes the user through the google sign in process. Next, the callback endpoint (/auth/google/callback) is entered, but I don't know what to do here. If I send back a json message or a redirect, it will only affect the new tab that was opened. How can I get this response back to the original add-on page?

I was looking at an add-on that has working authentication and they go through a similar process of opening a new tab, but their original add-on page somehow monitors or waits for authentication in the other tab to occur.



via Grant Golden

No comments:

Post a Comment