Reputation: 977
I'm working with Firebase Auth REST API and React Native using Axios and Redux.
I have an action to Sign in with email and password, this is my code:
export function signIn(data){
const request = axios({
method:'POST',
url:SIGNIN,
data:{
email: data.email,
password: data.password,
returnSecureToken:true
},
headers:{
"Content-Type":"application/json"
}
}).then(response => {
return response.data
}).catch( e => {
console.log(e)
return false
});
return {
type: SIGN_IN_USER,
payload: request
}
}
If I insert a credentials with email and password correctly everything is fine.
But if I insert an email with errors I expect an answer as indicated in the documentation by example:
EMAIL_NOT_FOUND: There is no user record corresponding to this identifier. The user may have been deleted.
INVALID_PASSWORD: The password is invalid or the user does not have a password.
USER_DISABLED: The user account has been disabled by an administrator.
But I only receive this answer if I generate some error:
Error: Request failed with status code 400
Nothing like the answers indicated in the documentation.
Can somebody help me? Thanks!!
Upvotes: 3
Views: 1928
Reputation: 21
I have the solution finally, just check how you have imported your firebaseConfig.js
where you have initialize your firebase.
Most of the case we export default firebaseConfig and import it as a object:
import { firebaseConfig } from './src/config/FirebaseConfig'; // Incorrect
import FirebaseConfig from './src/config/FirebaseConfig'; // Correct Order
Upvotes: 0