I’m reaching out regarding an issue we’re encountering in our Webflow project related to user management. Our project utilizes multiple access groups (students, admins, and tutors) and leverages the getMembershipConfig and userInfoChanged functions within the site’s custom code. This setup successfully retrieves user information and redirects users to the appropriate page based on their access group.
While the functionality generally works well, we’ve encountered an issue during debugging with multiple accounts. Specifically, user information, such as email, stops loading.
Here’s my question:
Is this a recognized issue with userInfoChanged?
Are there any known workarounds to prevent this behavior?
Alternatively, are there other recommended methods to access the logged-in user’s email address within Webflow’s custom code?
Site custom head code implementation:
window.sa5.push(['userInfoChanged',
(user) => {
// debugger;
currentUser = user; // saving into a variable to access across pages
console.log("USER INFO CHANGED", user);
let newUrl = window.location.origin;
switch(user.access_groups[0]){
// redirect logic
}
}]);
Make certain you’re using the latest version of the library, I’ve made some changes lately to support unusual network caching configs.
Otherwise, no. SA5 watches the entire process- log in, use the website, change info on the user accounts page, log out, and should always know your state. If you’re logging in and logging out as different users, should still work fine.
Note that Webflow will block logins at some point if you login/logout too many times from the same IP.
Thanks for the response! I actually just updated to Webflow version 5.4.0, hoping that might resolve the issue. Unfortunately, I’m still encountering the incomplete user object after successfully logging in with two different accounts.
However, I can log in/log out with different accounts without any problems, but the user object, stops loading some data like the email.
Can you elaborate or post more information about Webflow blocking logins?
Best guess would be a network issue or a server-side issue that’s causing a delay.
In the client-side SA5 libs, we have to pull the data from the /user-account page, and there’s an unknown delay before webflow.js makes that information accessible in the fields.
I’ve never encountered any issues like what you’re describing, but that’s the most likely scenario in which the info would not be available.
However the email address, for example, is captured at login, and is not re-retrieved. If your browser has extremely low memory, it may shut down webStorage, or affect your cache abilities, which would basically give it amnesia about what’s happening on the site.
You’d just need to dig through the situation using devtools to identify when and how the data is disappearing.
I primarily do client builds using our server-side products because the retrieval is instantaneous and more comprehensive ( it includes User ID ), and I can do things access-group gating on elements.
But many of my sites still use the client-side libs and we’ve not observed any issues or changes on Webflow’s end.
Based on your description I am suspicious that Webflow’s servers may have slowed a bit on the /user-account data loading, or perhaps you’re experiencing a network delay- I’m unable to reproduce it.
I’ve added some documentation under the troubleshooting page that includes an advanced setting that defines the amount of time SA5 wait for Webflow to load its data. Normally this is 300ms for loading the /user-account page data, or 500ms when the user makes a change and saves the data.
That’s always been configurable but I’ve just realized it’s not in the docs, so most people who use it know about it only from the Git repo code directly.