1

I need to do "OAuth 2.0 for Server to Server Applications" within a chrome extension. So I end up using something like chrome.identity.

I followed this: https://developers.google.com/identity/protocols/OAuth2ServiceAccount

I have this output:

{
  "private_key_id": "<Certificate_fingerprint>",
  "private_key": "<Private_key>",
  "client_email": "<Email_address>",
  "client_id": "<Client_ID>",
  "type": "service_account"
}

But I don't know how should I embed it to use it with chrome.identity and if there is another way with chrome extensions.

Normal User authentication was like this:

Adding to manifest:

  "permissions": [
       "*://*/*",
       "identity"

      ],

and

    "oauth2": {
         "client_id": "***",
         "scopes": [
                "https://www.googleapis.com/auth/drive",
                "https://www.googleapis.com/auth/drive.appdata",
                "https://www.googleapis.com/auth/drive.apps.readonly",
                "https://www.googleapis.com/auth/drive.file",
                "https://www.googleapis.com/auth/drive.metadata",
                "https://www.googleapis.com/auth/drive.metadata.readonly",
               "https://www.googleapis.com/auth/drive.readonly"
           ]
       }

and just to call from background script

    chrome.identity.getAuthToken
  • You can use chrome.identity.launchWebAuthFlow(). Check this example of github oauth: https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/github-auth – Sid Oct 15 '15 at 08:38
  • but I want to authentication with google API normally. – Nuha Khaled Oct 15 '15 at 10:43
  • See this answer : http://stackoverflow.com/questions/25044936/chrome-identity-user-authentication-in-a-chrome-extension – Sid Oct 15 '15 at 10:53
  • This one works with normal user authentication. My issue with with service account authentication. – Nuha Khaled Oct 15 '15 at 11:14
  • its incorrect (insecure) to use service accounts from a client. your secrets will be exposed to all. – Zig Mandel Oct 15 '15 at 13:17
  • This is for testing, I will transfer it after that to server side. Just I need to know how to do it. – Nuha Khaled Oct 15 '15 at 13:19
  • check this: http://stackoverflow.com/questions/33147821/drive-files-api-and-getting-organizations-files-chrome-extension – Nuha Khaled Oct 15 '15 at 13:24

0 Answers0