How to handle the authentication flow when using Google sign in in my Chrome extension - google-chrome-extension

I am planning to use Google sign in for my Chrome extension. I came across the following docs:
https://developers.google.com/identity/sign-in/web/sign-in
From what I understand, clicking on the auth button opens up another webpage, and then if the user authenticates the app, then they are redirected back to the page. Now, what if I want to do this from my Chrome extension that can run on my webpage/domain. What would be the workflow for authenticating then using Google sign in?

Related

I want to get accessToken from google oauth without opening browser or without opening any google popup using node js

I don't want to open any google form or modal from authentication.
Is there any way to authenticate and get all the google photos using clientId and clientSecret using node js as server only.
I tried some samples given over github and followed some more google stufs.
https://github.com/googleworkspace/node-samples

How to have sign-in open different window and get access token back

I am working on a chrome extension, and when a user creates an account within the extension, I want a separate tab to open up to allow the user to download a Shopify app, and once the app is downloaded that tab should close and the user should be authenticated within the extension. Opening a separate tab for the Shopify app install is trivial, but once that is done, how do I get the access token from the other tab into my chrome extension so that the user is authenticated there? Can I use a webhook for this? How are these types of authentications usually done, where the authentication is done in a separate window?
Basically, how do I get the access token that is returned in the second tab into my chrome extension so that the user can then use it to make api requests?

Chrome extension - Authenticate using web site and return API key to extension

I'm developing a chrome extension which will make API calls to a web app i built. I want to implement authentication into the extension in order to make the API call and perform other tasks in the extension.
I want to use OpenID for the authentication (Using Azure) so my thinking was:
Chrome extension launches and background script opens popup to the login page of my web app
User is redirected to Azure login and enters credentials
Webapp receives openid token with user details
Webapp generates api key and stores this along with user id in back-end
The next part i'm not sure on is how i return the api key and userid back to the extension.
My thinking was to generate a 'login successful' page which has this data stored in a hidden field that the browser extension can then grab via a content script and store it in local storage.
Looking for advice on whether this is a suitable method or if there is a better way.
Thanks!

Session Expired when using Passportjs Facebook from Facebook App in IOS

I tried using passportjs facebook on my website and tested on different browser but there’s a little bit problem when the link is from the facebook app itself specifically on IOS.
Package used: http://www.passportjs.org/packages/passport-facebook/
The scenario is:
Share your login url to post in your facebook timeline
Open facebook app on ipad
Click the link that was posted on facebook timeline to open the login url and a popup browser from facebook app should appear.
Click your facebook login using passportjs
Result:
Session Expired popup appear and you’ll be sign out and ask to login again but not from your url but from the app itself so I’m not getting the response login from it since it is not from passportjs login anymore. Any idea how to solve this or why is this happening?
So after some trial & error reading I found out I just need to turn on the "Force Web OAuth Reauthentication" inside Facebook Developer dashboard and now it continue login from IOS Facebook app when the link is from their.

Get the same user token in different accounts of Gmail in chrome extension

I have an google chrome extension write in JS which comes into play when the user is inside Gmail.
I am using chrome.identity.getAuthToken to get the token of user but the problem is that I get always same user token for who install the extension ,for example:
The chrome user profile is a...#gmail.com. So when I login to the gmail as a..#gmail.com, and go to the event page, and make a chrome.identity. getAuthToken, I get the token for a...#gmail.com, that is fine.
Now I login into the Gmail as b...#gmail.com. Now if I make a chrome.identity.getAuthToken, I still get the token for a...#gmail.com and I can't create request to Gmail API.
So,I try another way and success to get the id token using this Is it possible to get an Id token with Chrome App Indentity Api? qustion , but it's still the same problem that it's on the user who install the extnsion.
I try to follow this 2 similiar question here:
Get access to multiple gmail accounts in a chrome extension
Login to Chrome extension with a Google user other than the one in use by Chrome
But i am not really understand it , I need to create my own OAuth2 ?but how I can do it with chrome extension? I think maybe I need to send some request to 'https://accounts.google.com/o/oauth2/auth' + ..... to get the token but I am not sure about the parameters , and if it's right...
Hope you could help me , Thanks !

Resources