Ecommerce Shopify WordPress Discussion

Content Security Policy directive error google login

Here is my component: import {useMatches} from '@remix-run/react'; import {useRef, useEffect} from 'react'; import {multipass} from '~/lib/multipass/multipass'; interface GoogleJwTResponseType { credential: string; } declare global { var google: { accounts: { id: { initialize: (options: any) => void; renderButton: (element: HTMLDivElement | null, options: any) => void; }; }; }; } /* Google Sign in component. @see: https://developers.google.com/identity/gsi/web/guides/display-button */ export function GoogleLoginButton() { const [root] = useMatches(); const env = root?.data?.env; const init = useRef(false); const buttonRef = useRef<HTMLDivElement>(null); async function handleJwtResponse(response: GoogleJwTResponseType) { console.log(response) // authenticate google customer info via multipass await multipass({ token: response.credential, provider: 'google', redirect: true, // will redirect to }); } useEffect(() => { // if (typeof window?.google !== 'undefined' || init.current) return; init.current = true; const script = document.createElement('script'); script.src = 'https://accounts.google.com/gsi/client'; script.async = true; script.defer = true; script.onload = () => { google.accounts.id.initialize({ client_id: 'xxx, callback: handleJwtResponse, }); // @see: https://developers.google.com/identity/gsi/web/reference/js-reference#GsiButtonConfiguration google.accounts.id.renderButton( buttonRef.current, { theme: 'outline', text: 'Login in with Google', size: 'large', type: 'standard', autoPrompt: false, }, // customization attributes ); }; console.log(document.body); document.body.appendChild(script); }, []); return ( <div style={{width: '220px', height: '44px', overflow: 'hidde'}}> <div ref={buttonRef}>Loading...</div> </div> ); } i am trying to integrate google login into a remix app but i get the following error refused to load the script 'https://accounts.google.com/gsi/client' because it violates the following Content Security Policy directive: "default-src 'self' 'nonce-xxx' https://cdn.shopify.com https://shopify.com". Note that 'script-src-elem' was not explicitly set, so 'default-src' is used as a fallback.. Do i need to set some meta tags or is there any way to modify the script? i am trying to integrate google login into a remix app but i get the following error refused to load the script 'https://accounts.google.com/gsi/client' because it violates the following Content Security Policy directive: "default-src 'self' 'nonce-xxx' https://cdn.shopify.com https://shopify.com". Note that 'script-src-elem' was not explicitly set, so 'default-src' is used as a fallback.. Do i need to set some meta tags or is there any way to modify the script?
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.