I have a react app which allows the user to save documents. If the user is not logged in and tries to save it, I want the user to be redirected to a login prompt, and then be sent back to the app, which will then load the unsaved project and show the save dialog. I currently have this code connected to the save button:
const { isAuthenticated, loginWithRedirect } = useAuth0();
async function save() {
if(!isAuthenticated) {
loginWithRedirect({
appState: "insert current document here"
});
}
else {
// Save the project to a database
}
}
How can I access the appState
once Auth0 redirects the user back to my app?