"gapi is not defined" error - Chrome extension

Viewed 110

I'm developing a Chrome extension, which is supposed to schedule and manage meetings on Google calendar. I followed Google's documentation, but I get error "Uncaught ReferenceError: gapi is not defined".

I've added this line:

<script src="https://apis.google.com/js/client.js?onload=onGAPILoad"></script>

but then I get this error:

Refused to load the script 'https://apis.google.com/js/client.js?onload=onGAPILoad' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

The "permissions", "oauth2" and "content_security_policy" attributes in the manifest file are defined as follows:

  "permissions": [ 
    "cookies", "tabs", "bookmarks", "identity", "identity.email"
  ],
  "oauth2": {
    "client_id": "MY_CLIENT_ID.apps.googleusercontent.com",
    "scopes":["https://www.googleapis.com/auth/calendar"]
  },     
  "content_security_policy": {
    "extention_pages":"script-src 'self' https://apis.google.com; object-src 'self'"
  }

Any idea how to solve it? Any help towards fixing this error would greatly be appreciated.

0 Answers
Related