I’m developing a social platform where users can interact with features such as photo exchange and matching. Non-members (guests) are allowed to access certain limited functionalities without signing up. However, I’ve been experiencing various login and signup issues in both test and live environments:
Problems
- Test Environment: Login Issue
• After logging in, the app redirects users to the main page, but the login state isn’t maintained. Users appear logged out upon reaching the main page. - Live Environment: Signup Issues
• “Session expired” error: The error message reads, “Sorry, your login session has expired or changed. Please try again.”
• “User needs to be logged in” error: Another error message occurs: “The user must be logged in to modify their credentials.”
Implementation Details
• Guest Login: Guests are automatically logged in with a randomly generated email (e.g., randomID@domain.com) and flagged with isGuest = yes in the User database.
• Guest accounts have a scheduled backend API workflow to deactivate them after 1 hour of inactivity (isActive = no).
• Signup Workflow: When a guest decides to sign up, the app updates the same User entry with the user’s email and password via Update Credentials. Additional fields like isGuest (set to no) and profile details are also updated.
• Login Workflow: Guests can log out and log in with their credentials to access full member functionalities. The workflow also cancels all guest-specific actions, logs the guest out, and logs the user in with the provided credentials.
Workflows
-
Signup Workflow
- Validate user input (e.g., name, email, etc.).
- Update the guest User’s credentials with the new email and password.
- Cancel the guest’s deactivation schedule.
- Update isGuest to no and save additional profile information.
- Redirect the user to the previous page after a short pause.
-
Login Workflow
- Cancel all photo exchange and match actions related to the guest.
- Log the guest out.
- Log the user in with the provided credentials.
- Create notifications for actions like resetting photo exchange links.
- Redirect the user to the previous page after a short pause.
Troubleshooting Steps Taken
- Checked privacy rules: The User data type privacy allows This User is Current User to view fields, and no custom rules block the data.
- Verified database entries: Guest accounts and member accounts are created as expected, with unique fields properly updated.
- Tested on mobile and desktop: Login issues are more frequent in desktop environments, though they occur in both.
- Reviewed workflow delays: Added Pause steps to ensure processes (like credential updates) complete before redirection.
Suspected Causes
- Session Management Issue:
• The session might not properly transition from a guest session to a member session after credentials are updated, leading to errors like “Session expired” or the app incorrectly treating the user as logged out. - Test Environment Behavior:
• The login state may not persist properly in the test environment due to potential caching or Bubble’s handling of cookies during development.
Questions
- Is it expected behavior for login sessions to reset or not persist during page redirection?
- How can I ensure a seamless session transition when upgrading a guest to a fully logged-in user?
- Could this be related to how Bubble handles cookies or session tokens in the test/live environment?
- Are there best practices for managing guest-to-user conversion workflows in Bubble?
Any guidance or recommendations would be greatly appreciated. Thank you!