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