Can anyone illustrate how to resolve the following errors and allow me to authenticate through the oAuth client ID to return 6 videos from our youtube channel using a search term?
POST https://accounts.google.com/_/IdpIFrameHttp/cspreport/fine-allowlist 400 (Bad Request)Understand this errorAIcb=gapi.loaded_0?le=scs:169
cb=gapi.loaded_0?le=scs:153 Uncaught{error: 'idpiframe_initialization_failed', details: 'You have created a new client application that use…i/web/guides/gis-migration) for more information.'}details:"You have created a new client application that uses libraries for user authentication or authorization that are deprecated. New clients must use the new libraries instead. See the Migration Guide for more information."error: "idpiframe_initialization_failed"
// Load the Google API client libraryfunction loadClient() { import("https://apis.google.com/js/api.js").then(() => { gapi.load('client', initialize); })}// Initialize the API clientfunction initialize() { gapi.client.init({'apiKey': 'API-KEY','clientId': 'CLIENT-ID.apps.googleusercontent.com','scope': 'https://www.googleapis.com/auth/youtube.readonly','discoveryDocs': ['https://www.googleapis.com/discovery/v1/apis/youtube/v3/search'] }).then(function () { // Call the API to search for videos searchVideos('SEARCH-TERM'); });}// Search for videos using the YouTube APIfunction searchVideos(searchTerm) { return gapi.client.youtube.search.list({'part': 'snippet','q': searchTerm,'type': 'video','maxResults': 6 }).then(function(response) { displayVideos(response.result.items); }, function(error) { console.error('Error: '+ error); });}// Display videos on the WordPress pagefunction displayVideos(videos) { const videoContainer = document.getElementById('video-container'); videoContainer.innerHTML = ''; videos.forEach(video => { const videoElement = document.createElement('iframe'); videoElement.src = 'https://www.youtube.com/embed/'+ video.id.videoId; videoElement.width = '300'; videoElement.height = '200'; videoElement.allow = 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture'; videoElement.allowFullscreen = true; videoContainer.appendChild(videoElement); });}// Load the Google API client library on page loadwindow.onload = loadClient;// JavaScript Document<div id="video-container"> </div>