chrome extension: getting user's email address who logs into the google account/gmail account

后端 未结 1 1777
一个人的身影
一个人的身影 2021-01-24 02:44

I have built a chrome extension. Using chrome.identity.getAuth(), I am able to get token as described here https://developer.chrome.com/apps/app_identity. This token seems to be

相关标签:
1条回答
  • 2021-01-24 03:09

    I was able to solve this by choosing a web application type instead of a chrome app when generating the client id on google console.

    1. Choose a web application when you are generating the client key on google

      Javascript origins: https://<extensionid>.chromiumapp.org

      redirect url https://<extensionid>.chromiumapp.org/provider_cb

    2. extract the email page by reading the html from the contentscript.

    3. Pass a message with this email address to the background page.

    4. Follow the same as described in the github launchWebAuthFlow. [https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/github-auth]

    5. When calling the google auth url, also pass login_hint with the email address.
    0 讨论(0)
提交回复
热议问题