Webflow User Accounts / Memberships

Getting the User's Webflow User ID

Overview
Getting Started with User Accounts
000
User Accounts Current Features
001
User Accounts v. Memberstack
001
User Accounts Roadmap
002
Use Cases & Key Limitations
003
Customizing Membership UI
Building a Custom Login/Logout Button
8:50
110
Combining Log In / Sign Up into a Single Tabbed Page
8:41
111
Conditional Element Display, on Log-in State
7:34
112
Access-Group-Specific Sign-Up Forms
113
Customizing Membership Flow
Redirect Users to a Specific Page after Login
4:11
201
Redirect Users to a Specific Page after Registration
202
Log Out User
202
Getting Member Data
Getting the Logged-In User's Info
10:18
401
Getting the User's Webflow User ID
4:11
402
Customizing the Member UX
Customizing Webflow Site Search for User Accounts
601
SEO & Content Preview Approaches
602
Addendum
Other Membership Solutions
901
Memberships Loader
902
User-Specific Data
903
No items found.
Published
January 6, 2023
Updated
in lightbox
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.

FAQs

Answers to frequently asked questions.

Videos
No items found.
Table of Contents
Comments
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.