'Error: idpiframe_initialization_failed while implementing OAuth 2.0

I am getting this error while using OAuth 2.0 in my web application. I am building my application in React. I have created the OAuth Client ID as well. I am using Google Chrome Browser:

{error: 'idpiframe_initialization_failed', details: 'You have created a new client application that use…i/web/guides/gis-migration) for more information.'}

Below is my Google Auth code in react based web application:

import React from 'react';

class GoogleAuth extends React.Component {
    state = { isSignedIn: null };
     
     componentDidMount() {
         window.gapi.load('client:auth2', () => {
             window.gapi.client.init({
                 clientId: '716075642837-kergfh0638hu8iq5dimpgnlc1f08s61r.apps.googleusercontent.com',
                 scope: 'email'
             }).then(() => {
                 this.auth = window.gapi.auth2.getAuthInstance();
                 this.setState({isSignedIn: this.auth.isSignedIn.get()})
             });
         });
     }
     
     renderAuthButton() {
         if(this.state.isSignedIn === null) {
             return <div> I don't know if we are signed in </div>;
         } else if(this.state.isSignedIn) {
             return <div>I am signed in</div>
         } else {
             return <div>I am not signed in</div>
         }
     }
     
    render() {
        return <div> {this.renderAuthButton() } </div>;
    }
}

export default GoogleAuth;


Solution 1:[1]

you have to add plugin_name after the scope

         window.gapi.load('client:auth2', () => {
             window.gapi.client.init({
                 clientId: '716075642837-kergfh0638hu8iq5dimpgnlc1f08s61r.apps.googleusercontent.com',
                 scope: 'email',
                 **plugin_name: 'streamy'**
             }).then(() => {
                 this.auth = window.gapi.auth2.getAuthInstance();
                 this.setState({isSignedIn: this.auth.isSignedIn.get()})
             });
         });
     }```

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anjas Kurnia Sandy