# Memberstack

## Configuration

{% hint style="info" %}
You can find your Memberstack Site Id in your Memberstack V2 dashboard.
{% endhint %}

{% hint style="warning" %}
Memberstack V1 does not display the Site Id within the dashboard instead, you have to extract it from the JWT. Please raise a support ticket if you would like assistance getting your Memberstack V1 Site Id.
{% endhint %}

1. In the navigation, click the ⚙️ icon
2. In the Memberstack Site Id field, enter your Id
3. Save the changes
4. Open the flow you want to secure and add the Memberstack node after the `start` node.

🎉 Congratulations, you successfully secured your flow using Memberstack.

{% hint style="info" %}
The Memberstack node does **not** need to be added after the `start` node. If you would like to perform some logic before performing the authorisation check, this is absolutely fine.
{% endhint %}

### Access User Data

To access data associated with the user making the request, you can use the handlebar expressions e.g. `{{request.user.id}}`.

### Properties

<table><thead><tr><th width="132.5">Name</th><th>Expression</th></tr></thead><tbody><tr><td>id</td><td><code>{{request.user.id}}</code></td></tr><tr><td>email</td><td><code>{{request.user.email}}</code></td></tr></tbody></table>

{% hint style="danger" %}
WARNING the email property was deprecated in Memberstack V2!
{% endhint %}

{% hint style="info" %}
If you would like to access additional user data associated to the logged in user you will need to use the HTTP Request node to call the [Memberstack Admin API](https://support.memberstack.com/hc/en-us/articles/7444702068763-Memberstack-API).
{% endhint %}

## User Token

To access a user token for testing log into your website and run the following code snippet within the console.

#### Memberstack V1

```
MemberStack.getToken()
```

#### Memberstack V2

```
$memberstackDom.getMemberCookie()
```
