How to fix: Google Sign In button UNAUTHENTICATED

Im trying to add google signin button to my website but for some reason im getting error and i do not understand how to fix i looked at the link that is coming with the error message but still no able to fix it also i look another topics around but nothing that can help to fix my problem

Error

code: 401, message: "Request had invalid authentication credentials. Expected OAuth 2 access 
token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", 
status: "UNAUTHENTICATED" 

My Code:

            const apiKey = 'AIzaSyCb_LB2iFKvZGM5v31gLWPDs9G';
            const discoveryDocs = ["https://people.googleapis.com/$discovery/rest?version=v1"];
            const clientId = '259780-hj7t3cvl5q9nu7oblivmqqpih9qlqqor.apps.googleusercontent.com';
            const scopes = 'profile';
            const authorizeButton = document.getElementById('btn-google');

            if(authorizeButton){
                authorizeButton.addEventListener('click', () => {
                    gapi.load('client:auth2', initClient);
                })
            }

            function initClient() {
                gapi.client.init({apiKey: apiKey, discoveryDocs: discoveryDocs, clientId: clientId, scope: scopes, plugin_name: "chat"}).then(function () {
                    gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);
                    updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
                    authorizeButton.onclick = handleAuthClick;
                });
            }

            function updateSigninStatus(isSignedIn) {
                if (isSignedIn) {
                    makeApiCall();
                }
            }

            function handleAuthClick(event) {
                gapi.auth2.getAuthInstance().signIn();
            }

            function makeApiCall() {
            gapi.client.people.people.get({'resourceName': 'people/me', 'personFields': 'names,emailAddresses'}).then(function (resp) {

                try{
                    const formData = new FormData();
                    formData.append('email', resp.result.emailAddresses[0].value);
                    formData.append('firstname', resp.result.names[0].givenName);
                    formData.append('lastname', resp.result.names[0].familyName);
                    formData.append('password', '');

                    fetch('index.php?route=extension/module/google_login/login', {
                        method: 'POST',
                        body: formData,
                    })
                    .then(response => response.json())
                    .then(json => {
                        if(json.success == true){
                            updateHeader();
                        }
                    })
                }
            });
            }