Skip to content

Content Security Policy Issue #79

@rmartin93

Description

@rmartin93

Getting this error when the page loads:

Content Security Policy: The page’s settings blocked the loading of a resource at https://apis.google.com/js/api.js (“script-src”).

Here are my meta tags in my index.html

<meta 
    http-equiv="Content-Security-Policy"
    content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://apis.google.com"
/>
<meta
    http-equiv="Content-Security-Policy"
    content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://accounts.google.com"
/>

Here is the code from my component

import ApiCalendar from "react-google-calendar-api";

function Calendar() {
	ApiCalendar.onLoad(() => {
		ApiCalendar.handleAuthClick()
			.then(() => {
				console.log("sign in succesful!");
			})
			.catch((e) => {
				console.error(`sign in failed ${e}`);
			});
	});
	if (ApiCalendar.sign)
		ApiCalendar.listUpcomingEvents(10).then(({ result }) => {
			console.log(result.items);
		});
	return <div>Calendar</div>;
}

export default Calendar;

I'm just trying to console.log the events right now but it's not working. Any help would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions