Chrome Extension identity: OAuth2 request failed: Service responded with error: ‘bad request’

I followed https://developer.chrome.com/extensions/tut_oauth exactly step by step but I am stuck at

https://developer.chrome.com/extensions/tut_oauth#identity_permission

where after I execute my extension, instead of getting the token, I get the error:

Unchecked runtime.lastError while running identity.getAuthToken: 
OAuth2 request failed: Service responded with error: 'bad request'

Please suggest what is the possible cause of this error.

Google sheets add-on: create doGet and doPost endpoints

I am trying to build an add-on where in the user installs add-on and during configuration, I need to generate doGet and doPost URL’s(web app endpoints) to which user can post data.

From my research to generate doGet and doPost api URLs, the script has to be deployed as a web app from a particular user account.
Is it possible to deploy doGet and doPost code inside my add-on as web app from the installed sheets add-on?

Google Sheet API : “message”: “The request is missing a valid API key.”

I’m trying to make an extencion that will take some data from page and send it to google sheet.
My manifest:

"oauth2": {
        "client_id": "client_id",
        "scopes": ["https://www.googleapis.com/auth/spreadsheets"] 
    },
    "permissions": [
        "activeTab",
        "tabs", 
        "https://*.*/*",
        "storage",
        "declarativeContent",
        "identity",
        "https://ssl.gstatic.com/",
        "https://www.googleapis.com/*",
        "https://accounts.google.com/",
        "https://sheets.googleapis.com/",
        "https://www.googleapis.com/auth/spreadsheets/"
    ],
    "key": {key}

background page:

var tokenS;
chrome.runtime.onInstalled.addListener(function() {
  chrome.storage.sync.set({number: value}, function(data) {
  });
    chrome.identity.getAuthToken({
        interactive: false
    }, function(token) { 
        tokenS = token
        console.log(token)
    });
});
function writeData(request, sender){
    myspreadsheetId = "myspreadsheetId " 
    var params = {
        "range":"Sheet1!A1:A",
        "majorDimension": "ROWS",
        "values": [
            [request.name]
        ],
    }
    var xhr = new XMLHttpRequest();
    xhr.open('PUT', 'https://sheets.googleapis.com/v4/spreadsheets/' + myspreadsheetId + '/values/Sheet1!A1:A1?valueInputOption=USER_ENTERED');
    console.log(tokenS)
    xhr.setRequestHeader('Authorization', 'Bearer '+tokenS);
    xhr.send(JSON.stringify(params));
};
chrome.runtime.onMessage.addListener(writeData)

I receive next error:

{
  "error": {
    "code": 403,
    "message": "The request is missing a valid API key.",
    "status": "PERMISSION_DENIED"
  }
}

at google cloud platform I see a 100% error ratio (http://prntscr.com/jvfl0c). And I do not understand what I’m doing wrong. Pleasse help.

How to use Twitter API in chrome extension to get cryptocurrency data?

I would like to create a chrome extension that can get twitter feed (about bitcoin or any cryptocurrency data) and add all the data in the a google sheet.

Google Sheets API and Chrome Apps

I have an app that’s pulling data from Google Sheets with background.js but I am unable to use that information in the popup.js itself. I am not too familiar with Chrome Apps, what can I do in this case? How do I get Chrome Identity or the API to pass the information to popup.js? I can’t implement the API call in popup.js because I need it to work in the background.

So I want to modify a sheet with the Google Sheets API and then read off it.

I am basically doing this in the background.js:

chrome.identity.getAuthToken({ 'interactive': true }, function(token) {
    var response;
    var requestURL = "https://sheets.googleapis.com/v4/spreadsheets/" + spreadsheetId + "/values/" + range;
    var objectHTTP;
    objectHTTP = new XMLHttpRequest();
    objectHTTP.onreadystatechange = function() {

    if (objectHTTP.readyState == 4 && objectHTTP.status == 200) {
            response = objectHTTP.responseText;
        }
    };

    objectHTTP.open("GET", requestURL, false);
    objectHTTP.setRequestHeader('Authorization', 'Bearer ' + token);
    objectHTTP.send();

    // This is the part where I obtain the response, but how do I use it in the main app (popup.js)? Can I somehow share the variables?
    });

Google slides auto update links /tables linked from google sheet

I have a google slides presentation that has some linked cells/table from google sheets. Currently, I have to manually click each linked cell/table to update values.
I need apps script for google slides that would auto update / batchupdate / refresh links, so that the values/tables get auto update. Is that possible?

Chrome extension content security policy violated while trying Google Sheets API call

I am making my first chrome extension. My idea is to call Google Sheets API to append a row in a google spreadsheet from my extension. I am referring this link for the same and successfully tried the API to append row in my desired sheet.

Now I am trying to do the same from my chrome extension. But the below line throws error:

 

The error is at src="https://apis.google.com/js/api.js". Error message is:

Refused to execute inline event handler because it violates the
following Content Security Policy directive: “script-src ‘self’
https://apis.google.com/js/api.js“. Either the ‘unsafe-inline’
keyword, a hash (‘sha256-…’), or a nonce (‘nonce-…’) is required
to enable inline execution.

For this, I tried adding following lines in my manifest.json file:

"permissions": ["activeTab", "storage", "https://apis.google.com/js/api.js"],
"content_security_policy": "script-src 'self' https://apis.google.com/js/api.js; object-src 'self'"

Still I am getting the error message highlighted above. I tried using unsafe-inline as well but chrome browser is ignoring it.

Any ideas what am I missing?

Many thanks in advance.

Closed the chrome add on but the process still runs and doesnt terminate how to fix this?

Am currently working on developing a chrome addon.. when i click the close button in the sidebar the addon gets closed but the process doesnt terminate and keeps running how to fix this?