Google authorization returns 403 forbidden

Viewed 172

React component with componentDidMount method, after window.gapi.load call, in network panel browser and console i have 403 forbidden error with response below. I saw docs and i didn't found 403 forbidden with this error message code.


    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="utf-8" />
        <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <meta name="theme-color" content="#000000" />
        <meta
          name="description"
          content="Web site created using create-react-app"
        />
        <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
    
        <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    
        <script src="https://apis.google.com/js/api.js"></script>
        <script src="https://apis.google.com/js/platform.js"></script>
        <title>React App</title>
      </head>
      <body>
        <noscript>You need to enable JavaScript to run this app.</noscript>
        <div id="root"></div>
        
      </body>
    </html>

    componentDidMount() {
        const onInit = (auth2 => {
            this.setState(() => ({
                authorized: window.gapi.auth2.getAuthInstance().isSignedIn.get()
            }))
        }).bind(this)

        const onError = err => {
            console.log('error', err)
        }
        window.gapi.load('auth2', function () {
            window.gapi.auth2
                .init({
                    client_id:
                        process.env.REACT_APP_GOOGLE_CLIENT_ID,
                })
                .then(onInit, onError)
        })
    }

403 Forbidden

https://accounts.google.com/o/oauth2/iframerpc?action=issueToken&response_type=token id_token&login_hint=AJDLj6JUa8yxXrhHdWRHIV0S13cAQkWEAPWplFnV5UerxbKZb6kHhcraZKDnrovJi4PbVrzX39mlnv4ILIcpkZdqDkhhhY9wilNnFidqJ9v6El4y35zN64V74PuJxV-d6qoxXr-9TER1&client_id=20176736559-mu75ue3gimbftv2kvildmso7ravgpn5a.apps.googleusercontent.com&origin=http://localhost:3000&scope=openid profile email&ss_domain=http://localhost:3000

Response:

{
  "error" : "invalid_request"
}

Any reasons? I did all steps at developer console.

0 Answers
Related