Authenticate Chrome extension with non-Google API using Google account

Mark Embling

I work for an educational institution which is making heavy use of Google Apps and now ChromeOS devices. A project we've embarked upon is to develop a Chrome extension (possibly multiple) which will duplicate functionality we have in the Windows environment. These will be used only within our domain and on our devices, not available generally.

We have an HTTP/JSON-based API built in-house which provides various details such as reminders and other stuff from our MIS (again, built in-house) and can provide popups with this information and so on. It's possible to make sure the API knows who the current user is via NTLM authentication under Windows.

I need some way of the API being able to know who the user is when accessing from a Chrome device. This means the extension needs to be able to tell the API who the user is in a secure manner. If the API can establish the logged in user's Google Apps email address, it can determine who the person is from our database. My question is, how do I achieve this?

Some solutions that have been considered and rejected:

  • Have the extension simply tell the API the current user's email address
    Rejected due to the fact it could be easily faked. This must be secure.
  • Ask the user for their Active Directory credentials instead
    The extension should be able to operate without user input - we can authorise the extension against the Google Apps domain on users' behalf.

In addition the Google OAuth 2.0 for login seems to be specific to websites which are presented in a browser. This needs to be handled silently.

I understand that this is a very vague question, but any recommendations or examples of very similar problems being solved would be appreciated. The core of it is this: how can I have a Chrome extension authenticate with a non-Google API using Google credentials? (The API can be extended to support this in any way necessary.)


Some further details:

  • Our API is .NET-based
  • The Chrome extension will run on our devices within the College only and these devices will be registered to our domain. Only users within that domain will be logged on and running the extension.
David

You can do the following :

  1. In the Google Cloud Console, create an API credential for a Chrome extension

How to create a Chrome extension client id in the Google Cloud Console

  1. In the Chrome extension, use the Identity API to obtain an authentication token for this application and send it to your API. You only need this scope : https://www.googleapis.com/auth/userinfo.email

  2. On your API side, every time you receive a token, access the following URL (replace the access token in the example with the one sent by the extension) :

    https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=ya29.iAXXXXXXXXXXXXXXi-mrflhzc-X-U14eb

You will get something like this :`

{
 "issued_to": "407408718192.apps.googleusercontent.com",
 "audience": "407408718192.apps.googleusercontent.com",
 "user_id": "1170123456778279183758",
 "scope": "https://www.googleapis.com/auth/userinfo.email",
 "expires_in": 3585,
 "email": "[email protected]",
 "verified_email": true,
 "access_type": "offline"
}

Make sure that the audience is the Chrome client id (very important), and you have the email !

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Access Local Files using a Google Chrome Extension

From Dev

Google Chrome - Extension vs App

From Dev

Google Chrome Extension Opening Url

From Dev

Javascript not working in a google chrome extension

From Dev

angularjs and google chrome extension

From Dev

Redirect to url Using Google chrome Extension

From Dev

Insert event with Google Calendar API in Chrome Extension keeps failing

From Dev

How to authenticate with Google Email Settings API using service account oauth2 Python client?

From Dev

Use oauth2 service account to authenticate to Google API in python

From Dev

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

From Dev

Chrome Extension - Javascript Origins for Google API

From Dev

Changing the background of the google search page using my chrome extension

From Dev

Injecting jQuery into Google.com using a Chrome Extension

From Dev

Authenticate own Google account for Blogger API with Java

From Dev

Using Google Charts in Chrome extension

From Dev

Add contact using contact app to a non google account

From Dev

Outputting Google API Calls Inside Chrome Extension

From Dev

Using non-default service account in Google Cloud dataproc

From Dev

Authenticate own Google account for Blogger API with Java

From Dev

Extension to Google Chrome browser that restarts Google Chrome

From Dev

Using google closure library inside chrome extension content script

From Dev

Is there a way to pass information from Google Chrome using an extension?

From Dev

angularjs and google chrome extension

From Dev

Error with google chrome extension

From Dev

Google Chrome extension malware?

From Dev

Add contact using contact app to a non google account

From Dev

Sign in to Chrome with google account

From Dev

Defining a hotkey in Google documents using Chrome extension

From Dev

Powershell for Google Cloud: Authenticate with a service account

Related Related

  1. 1

    Access Local Files using a Google Chrome Extension

  2. 2

    Google Chrome - Extension vs App

  3. 3

    Google Chrome Extension Opening Url

  4. 4

    Javascript not working in a google chrome extension

  5. 5

    angularjs and google chrome extension

  6. 6

    Redirect to url Using Google chrome Extension

  7. 7

    Insert event with Google Calendar API in Chrome Extension keeps failing

  8. 8

    How to authenticate with Google Email Settings API using service account oauth2 Python client?

  9. 9

    Use oauth2 service account to authenticate to Google API in python

  10. 10

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

  11. 11

    Chrome Extension - Javascript Origins for Google API

  12. 12

    Changing the background of the google search page using my chrome extension

  13. 13

    Injecting jQuery into Google.com using a Chrome Extension

  14. 14

    Authenticate own Google account for Blogger API with Java

  15. 15

    Using Google Charts in Chrome extension

  16. 16

    Add contact using contact app to a non google account

  17. 17

    Outputting Google API Calls Inside Chrome Extension

  18. 18

    Using non-default service account in Google Cloud dataproc

  19. 19

    Authenticate own Google account for Blogger API with Java

  20. 20

    Extension to Google Chrome browser that restarts Google Chrome

  21. 21

    Using google closure library inside chrome extension content script

  22. 22

    Is there a way to pass information from Google Chrome using an extension?

  23. 23

    angularjs and google chrome extension

  24. 24

    Error with google chrome extension

  25. 25

    Google Chrome extension malware?

  26. 26

    Add contact using contact app to a non google account

  27. 27

    Sign in to Chrome with google account

  28. 28

    Defining a hotkey in Google documents using Chrome extension

  29. 29

    Powershell for Google Cloud: Authenticate with a service account

HotTag

Archive