Issue with 'A continue URL must be provided in the request'
Ghadir31 opened this issue · 1 comments
Hello, I downloaded the project, connected it to a firebase project, and ran it locally. On the signup page, users are being registered normally, but it fails to redirect to Home after the signup, even though this part of the code is supposed to do it (I guess):
//inside the onSubmit function in SignUp component:
this.props.firebase
.doCreateUserWithEmailAndPassword(email, passwordOne)
.then(authUser => {
// Create a user in your Firebase realtime database
return this.props.firebase.user(authUser.user.uid).set({
username,
email,
roles,
});
})
.then(() => {
console.log("email verification sent ---2")
return this.props.firebase.doSendEmailVerification();
})
.then(() => {
console.log("setting state --2")
this.setState({ ...INITIAL_STATE });
this.props.history.push(ROUTES.HOME); //this is supposed to work, but it is not
})
.catch(error => {
if (error.code === ERROR_CODE_ACCOUNT_EXISTS) {
error.message = ERROR_MSG_ACCOUNT_EXISTS;
}
this.setState({ error });
});
I haven't changed anything about the project (except adding firebase), and still, I am getting the 'A continue URL must be provided in the request' message. Am I supposed to add it somewhere else? Thanks for any help, I am still a beginner in the whole authentication thing.
Alright solved my own problem. I provided the continuation URL by following the steps in this link:
https://stackoverflow.com/questions/49579028/adding-an-env-file-to-react-project
We will be dealing with the firebase.js file inside Firebase folder, not with the SignUp file as I initially thought.
I am also not very interested in hiding the homepage link (will not use gitignore for .env here), so in short, here are the steps:
-
npm install dotenv --save
-
Next add the following line somewhere at the top of your firebase.js file:
require('dotenv').config()
- Then create a .env file at the root directory of your application and add the variables to it. Don't create this file inside /src -> create it at the root (alongside /src), and name it '.env' (starting with a point).
// contents of .env
REACT_APP_CONFIRMATION_EMAIL_REDIRECT=http://localhost:3000
Also, don't forget to change the link for production.