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 !