Error in background request for Chrome app/extension, or problem allowing app to access Google Docs API

I'm encountering an issue where the Google Doc API is not allowing a desktop application to be installed, although this worked fine in Chrome 27.0 previously.

Below is my Manifest.Json file:

{
  "name": "__MSG_extName__",
  "description": "__MSG_extDescription__",
  "version": "4.0",
  "default_locale": "en_US",
"background": {
  "page": "background.html"
},
  "offline_enabled": true,
  "options_page": "options.html",
  "manifest_version": 2,
  "app": {
    "launch": {
      "local_path": "index.html"
    }
  },
  "icons": {
    "16": "16icon.png",
    "48": "48icon.png",
    "128": "icon.png"
  },
  "permissions": [
    "<all_urls>",
    "unlimited_storage",
    "notifications",
    "tabs",
      "https://docs.google.com/feeds/*",
      "https://www.google.com/accounts/OAuthGetRequestToken",
      "https://www.google.com/accounts/OAuthAuthorizeToken",
      "https://www.google.com/accounts/OAuthGetAccessToken"

  ],

   "content_security_policy": "script-src 'self'; object-src 'self'",


  "web_accessible_resources": [
    "chrome_ex_oauthsimple.js",
    "chrome_ex_oauth.html", 
    "back-main.js",
    "cloud.js"  
  ]

}

I've identified an error in the background.html section as well.

ChromeExOAuth.prototype.onAccessToken = function(callback, xhr) {
  if (xhr.readyState == 4) {
    var bg = chrome.extension.getBackgroundPage();
    if (xhr.status == 200) {
      var params = ChromeExOAuth.formDecode(xhr.responseText);
      var token = params["oauth_token"];
      var secret = params["oauth_token_secret"];
      this.setToken(token);
      this.setTokenSecret(secret);
      bg.chromeExOAuthRequestingAccess = false;
      callback(token, secret);
    } else {
      bg.chromeExOAuthRequestingAccess = false;
      throw new Error("Fetching access token failed with status " + xhr.status);
    }
  }
};

Answer №1

I was previously concerned about the same issue. However, I managed to resolve it using "setTimeout", even though the version of Chrome is 29.x. The code snippet can be found below...

File Name: chrome_ex_oauth.js Line Number: around 77

77>  chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {

      //original_modify/////////////////////////////////////////////////
      setTimeout(function(){

78>    if (changeInfo.url &&
79>      changeInfo.url.substr(0, url_match.length) === url_match &&
80>      changeInfo.url != tabs[tabId] &&
81>        window.chromeExOAuthRequestingAccess == false) {
82>      chrome.tabs.create({ 'url' : changeInfo.url }, function(tab) {
83>        tabs[tab.id] = tab.url;
84>        chrome.tabs.remove(tabId);
85>      });
86>    }

      //original_modify/////////////////////////////////////////////////
      },500);

87>  });

What are your thoughts on this solution?

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

An error occurred during the extraction of nested JSON data in a SQL query

I have encountered an issue while running an SQL query to extract nested JSON data. SELECT watsonResponse.responseId, watsonResponse.chatId, d.* FROM watson_response_table watsonResponse CROSS JOIN LATERAL ( SELECT d2.* FROM ...

Modifying the Key in a Dictionary

I have a function that retrieves data from a DataTable and converts it into JSON format. Here is the code snippet: public object DataTableToJSON(DataTable table) { var list = new List<Dictionary<string, object>>(); foreach ...

Is Vue function only operating after editing and refreshing?

I'm facing an unusual issue in my Vue function where it only seems to work after causing an error intentionally and then refreshing the page. The code itself works fine, but there's a problem with the initialization process. Can someone provide s ...

Using Play2 Scala to Convert Json into a Collection of Objects

I've been working on deserializing a JSON response body that I receive through Play's WSClient into a list of objects. Although I feel like I'm close to achieving it, there seems to be one missing piece in the puzzle. Below are the case cla ...

The JSON-generated input form is not appearing in the $_POST method

Using json to fetch data from the database, I encounter an issue where certain input fields retrieved from JSON are not displayed when I print $_POST. print_r($_POST); // prints everything except the input fields obtained from JSON This is my PHP code: ...

Unable to upload photo using Ajax request

I am in the process of trying to utilize Ajax to upload an image, so that it can be posted after the submit button is clicked. Here is the flow: User uploads image -> Ajax call is made to upload photo User clicks submit -> Post is shown to the user ...

How can you optimize the storage of keys in JS objects?

Just pondering over this scenario: Consider a line definition like the one below, where start and end are both points. let ln = { s: {x:0, y:0}, e: {x:0, y:0}, o: 'vertical' } Now imagine having a vast array of lines, how can we sav ...

Sending handlebars variable to the client-side JavaScript file

I am currently working on an application using node.js along with express and handlebars, and I'm trying to find a way to transfer handlebars data from the server to client-side JavaScript files. Here is an example: //server.js var person = { na ...

Setting an HTML element ID on a material-ui component: A step-by-step guide

I have a website that was created using Gatsby.js and incorporates the Material-UI framework. The specific issue at hand is as follows: I am looking to implement Google Tag Manager "Element Visibility" triggers. The goal is for GTM to trigger a Google Ana ...

Updating the state of a nested array using React Hooks

After spending some time working with React Hooks, my main struggle has been dealing with arrays. Currently, I am developing a registration form for teams. Each team consists of a list of players (an array of strings). The goal is to allow users to add t ...

Saving numerous files with Promises

There is a Node URL (created using Express) that enables users to download static images of addresses. The calling application sends a request to the /download URL with multiple addresses in JSON format. The download service then calls Google Maps to save ...

Is it recommended for synchronous code invoked by a Promise's .then method to generate a fresh Promise

I recently wrote some code containing a mix of asynchronous and synchronous functions. Here's an example: function handleAsyncData() { asyncFunction() .then(syncTask) .catch(error); } After some research, I learned that the then method is ...

Animate the tubular geometric pathway by continuously updating its values

When creating a TubeGeometry, I supplied a SplineCurve3 / CatmullRomCurve3 path as a parameter. My goal is to update the position of each point on the path using geometry.parameters.path.points[1].y += 0.01; within the requestAnimationFrame loop. Even tho ...

"Key challenges arise when attempting to execute the node app.js script through the terminal due to various middleware compatibility

I'm a beginner with node.js and I've encountered an issue while trying to run my node app.js file after incorporating a new file named projects.js which contains the following JS code: exports.viewProject = function(req, res){ res.render(" ...

Having trouble getting getStaticProps to display JSX in Next.JS

I'm currently facing an issue with rendering basic data from a locally hosted Strapi API in my Next.js project. Although the data is successfully logged in the console, I am unable to map it into JSX. Below is the API get function: export async func ...

Chrome Selenium webdriver facing issues with HTTP url authentication

By simply entering the following URL directly into your browser, it functions as expected: http://username:p%<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4f7b7f3c3c38203d2b0f2a372e223f232a3c263b2a612c2022">[email pro ...

Webpack attempting to load build.js from a nested folder

I am in the process of setting up a Vue app with Vuetify and Vue Router. Everything works fine when I load the base URL "/", and I can easily navigate to /manage/products. However, if I try to directly access /manage/products by typing it into the address ...

A common inquiry: how can one pinpoint a location within an irregular figure?

I have been studying Html5 Canvas for a few weeks now, and the challenge mentioned above has puzzled me for quite some time. An irregular shape could be a circle, rectangle, ellipse, polygon, or a path constructed by various lines and bezier curves... I ...

Accessing data outside of the scope when looping through items in Angular forEach

I am currently working on retrieving the Game ID generated by the APIService.postData method for the game. The goal is to utilize this Game ID within the Angular foreach loops to maintain foreign key constraints on the RESTful side. Any advice on extracti ...

Can someone explain why my button icons are not aligning to the center properly?

I have a small issue with the icons I pulled from react-icons - they appear slightly raised within the buttons. How can I position them in the middle? That's my only query, but I can't post it alone due to mostly having code in my post. What an ...