Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Security Policy Issue #79

Open
rmartin93 opened this issue Apr 22, 2022 · 1 comment
Open

Content Security Policy Issue #79

rmartin93 opened this issue Apr 22, 2022 · 1 comment

Comments

@rmartin93
Copy link

rmartin93 commented Apr 22, 2022

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.

@Kubessandra
Copy link
Owner

Hi does it work without the CSP meta tags ?
This looks like more of a CSP issue than the package, but I can try to help you on that (https://stackoverflow.com/questions/37298608/content-security-policy-the-pages-settings-blocked-the-loading-of-a-resource)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants