Webflow User Accounts ( Memberships )

Getting the User's Webflow User ID

No items found.
Overview
Getting Started with Memberships
000
Memberships Current Features
001
Memberships Roadmap
002
What is Memberships Good For?
003
Customizing Membership UI
Building a Custom Login/Logout Button
Adv
8:50
110
Combining Log In / Sign Up into a Single Tabbed Page
Adv
8:41
111
Conditional Element Display, on Log-in State
Adv
7:34
112
Access-Group-Specific Sign-Up Forms
Adv
113
Customizing Membership Flow
Redirect Users to a Specific Page after Login
Adv
4:11
201
Redirect Users to a Specific Page after Registration
Adv
202
Log Out User
Adv
202
Getting Member Data
Getting the Logged-In User's Info
Adv
10:18
401
Getting the User's Webflow User ID
Adv
4:11
402
Customizing the Member UX
Customizing Webflow Site Search for User Accounts
Adv
601
SEO & Content Preview Approaches
Adv
602
Addendum
Other Membership Solutions
901
Memberships Loader
902
User-Specific Data
903
No items found.
WARNING: The notes here are not so much a solution, as a discussion of an approach that can be used. It is a very convoluted approach, and at this point, I wouldn't recommend it for use on any client site. You have been warned.

Problem

In our client-side Javascript, we want the UserID of the currently logged-in Memberships User.

It's not available [ 2023-07-13 ], anywhere. Not in script, not in any URL or HTML.

It is in a cookie, buried in an MD5-encoded JWT token, however that cookie is http-only which means our scripts cannot access it.

Solution

PART 1: Make the ID accessible

At present the Membership User _id is only exposed server-side, so you need to make that accessible client-side. For many, the most efficient approach is to duplicate that ID into a custom data field on that same User record.

Here's how to automate that process;

Webflow setup;

  1. In Webflow, create a custom User Data plain-text field, called user-id
  2. On your User Account page, add that field to your user account form. You can hide it by placing it inside of a DIV that is display: none. However it must be on the page, and must be in the form.

Automation setup;

  1. Create a webhook-triggered automation on your favorite automation platform* ( Make, Zapier, n8n... ). When a new user is created, your automation will be called and you’ll have the user’s ID.
  2. Copy that webhook trigger URL, and use it to setup a Webflow webhook to fire when a new user is created. You want the memberships_user_account_added webhook.
  3. In your automation, immediately update that same User record, pushing that user_id into a custom Member field you’ve already created. Now, that ID is accessible on the /user-account page as a custom field.

* As of 2023-07-13, Logic unfortunately cannot be used in this situation, since it is unable to call the Webflow API.

PART 2: Access that UserID

Use Sygnal's User Info attributes to access the logged-in user's info, including those custom user fields.

You now have access to the ID.

Table of Contents
Did we just make your life better?
Passion drives our long hours and late nights supporting the Webflow community. Click the button to show your love.