Fetch logged in user data - client side javascript

I’m creating “Users” and then pages that has restricted access to these pages. Which all works fine.

I’m trying to run some client side code in order to see who is logged in:

const membersAPI = window.Webflow && Webflow.require(‘members’);

Webflow.require(‘members’) is always undefined.

During runtime i’d simply like to see username, fullname and perhaps custom properties using javascript in the client.

Does this not exist? is it possible to, with client side javascript, fetch the user?

Thanks in advance.


Here is my site Read-Only: LINK
(how to share your site Read-Only link)

I built a lib to handle this client-side-
Let me say that while it works great for my clients, the setup is awkward and the integration is “loose”, since I have to work at the UI level to extract the user info.

Memberstack is a better approach as it offers direct access to user info from script.

Thanks. @memetican your library does work this purpose.

Also thanks for hinting about memberstack.