Rank 2: Process
Hopefully this isn't a complete dingus of a question.
Tl;dr I'm building a simple web-app with user-auth, upon log in a user is directed to their profile page. While logged in, if the user refreshes the page, they're logged out. Is this the correct response or do I not know what I'm doing?
The user logs in via email and password, an email session is created. I get their user information and send that to context so I can access their ID, name and avatar app-wide:
setLoading(true); await account.createEmailSession(email, password); const userInfo = await getCurrentUser(); authUser(userInfo); navigate('/profile'); }I'm using react-router to have protected paths, I have a helper function that will send a unauthorized user to the log-in if they try to access a restricted page such as profile.
Is the user logged out on refresh because, by default, appwrite uses localStorage for session management, and that's the correct action?
Is the solution to add a custom domain as an endpoint?
If so, can the app run on a subdomain and a different subdomain accesses the API? If I have example.com, can I use demo-app.example.com for the app and appwrite.example.com for the API? Or does it need to be a subdomain - SLD relationship to work?
Thanks in advance!