Error requesting network on Firebase with ReactJS

I am learning ReactJS and I wanted to try it with Firebase after a little guide. I have to log in using Google auth in Firebase, but I always get this error:

Error auth / network-request-failed: a network error has occurred (for example, timeout, disconnected or inaccessible host).

import React, { Component } from 'react';
import firebase from 'firebase';
import logo from './logo.svg';
import './App.css';

class App extends Component {

  handleAuth() {
    const provider = new firebase.auth.GoogleAuthProvider();
    firebase.auth().signInWithPopup(provider)
      .then(result => console.log(`${result.user.email} ha iniciado sesión`))
      .catch(error => console.log(`Error ${error.code}: ${error.message}`));
  }

  render() {
    return (
      <div className="App">
        <div className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <h2>ReactGIFs</h2>
        </div>
        <p className="App-intro">
          <button onClick={this.handleAuth}>Login with Google</button>
        </p>
      </div>
    );
  }
}

export default App;

And firebase.initializeApp()with data copied from Firebase. Thank.

+4
source share

Source: https://habr.com/ru/post/1671912/


All Articles