Uncaught auth error
See original GitHub issueWhen I use useAuthState
with signInWithPopup
and close the popup without authenticating, the error state is not reached.
After a second these two errors appear in the console:
Uncaught: {code: "auth/popup-closed-by-user", message: "The popup has been closed by the user before finalizing the operation."}
Uncaught Error: The error you provided does not contain a stack trace.
I was expecting this error to cause useAuthState to reach the error state. Is this behavior expected?
The following code dropped into the CreateReactApp boilerplate will reproduce this error. In fact, all errors seem to cause the aforementioned result.
import React from 'react'
import * as firebase from 'firebase/app'
import 'firebase/auth'
import { useAuthState } from 'react-firebase-hooks/auth'
const firebaseConfig = {
// copied from firebase console
}
firebase.initializeApp(firebaseConfig)
const provider = new firebase.auth.GoogleAuthProvider()
const login = () => {
firebase.auth().signInWithPopup(provider)
}
export const logout = () => {
firebase.auth().signOut()
}
export const App = () => {
const [user, initialising, error] = useAuthState(
firebase.auth(),
)
if (initialising) {
return (
<div>
<p>Initialising User...</p>
</div>
)
}
if (error) {
return (
<div>
<p>Error: {error}</p>
</div>
)
}
if (user) {
return (
<div>
<p>Current User: {user.email}</p>
<button onClick={logout}>Log out</button>
</div>
)
}
return <button onClick={login}>Log in</button>
}
My package versions:
{
"firebase": "^6.6.2",
"react": "^16.9.0",
"react-firebase-hooks": "^2.1.0",
}
Thanks for the great library!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Why this error is showing " Uncaught FirebaseError: Firebase
After creating the environment variable I'm getting this error "Uncaught FirebaseError: Firebase: Error (auth/invalid-api-key)." https://i.
Read more >Admin Authentication API Errors | Firebase - Google
Here is a full list of the error codes and descriptions, ... The error message should contain the response from the Authentication server...
Read more >Uncaught auth/invalid-email on signInWithEmailAndPassword ...
Error with code auth/invalid-email is thrown when calling signInWithEmailAndPassword with invalid mail, such as test123 although there is a catch clause.
Read more >Handle errors and exceptions in MSAL.js - Microsoft Entra
ClientAuthError : Error class, which denotes an issue with Client authentication. Most errors that come from the library will be ...
Read more >Authorization Errors | Device Access - Google Developers
When attempting to get an access or refresh token, you will get an "Invalid client" error if you provide an incorrect OAuth 2.0...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No guys, you can use the hook and its loading param after the user signs in, you are not using the hook to sign in the users right. You are using the firebase sdk so, you will have to handle auth errors during login and sign up yourself.
Check this solution: https://github.com/CSFrequency/react-firebase-hooks/issues/85#issuecomment-754084044
Just tried the example you provided
Same result. Uncaught error. Using
v2.1.0