<commit_before>---
description: How to link user accounts with server-side code.
crews: crew-2
---

# Account Linking from Server Side Code

In this scenario, you will search for users with same verified email address, (as with an automatic linking rule). However, instead of completing the link automatically on authentication, your app will first prompt the user to link their identities.

**NOTE:** You can find sample code for this at the [Auth0 Node.js Regular Web App Account Linking](https://github.com/auth0/auth0-link-accounts-sample/tree/master/RegularWebApp) sample on Github.

The following steps implement suggested account linking for a Regular Web App:

## 1. Initial Login

First, the user will authenticate to the website using either [Lock](https://github.com/auth0/lock), [Lock Passwordless](https://github.com/auth0/lock-passwordless), or [Auth0.js](/libraries/auth0js) and a custom UI.

![](/media/articles/link-accounts/regular-web-app-initial-login.png)

The following is a sample login using Lock:

```html
<script src="${lock_url}"></script>
<script type="text/javascript">
  function signin() {
    var lock = new Auth0Lock('${account.clientId}', '${account.namespace}');<commit_msg>Edit intro<commit_after>---
description: How to link user accounts using server-side code.
crews: crew-2
---

# Account Linking Using Server Side Code

In this tutorial, you will use server-side code to facilitate account linking on a regular web application. Your code will:

1. Authenticate the user;
2. Search for and identify users using their email addresses;
3. Prompt the user to link their accounts.

Rathan than automating the entire account linking process, you're engaging the user and asking them for permission before proceeding.

:::panel-info Sample Code
You can find sample code for this tutorial in the [Auth0 Node.js Regular Web App Account Linking](https://github.com/auth0/auth0-link-accounts-sample/tree/master/RegularWebApp) repo on Github.
:::

## Step 1: Authenticate the User

To authenticate the user, you can use one of the following:

* [Lock](https://github.com/auth0/lock), [Lock Passwordless](https://github.com/auth0/lock-passwordless), or [Auth0.js](/libraries/auth0js) and a custom UI.

![](/media/articles/link-accounts/regular-web-app-initial-login.png)

The following is a sample login using Lock:

```html
<script src="${lock_url}"></script>
<script type="text/javascript">
  function signin() {
    var lock = new Auth0Lock('${account.clientId}', '${account.namespace}');
{'fraction_non_alphanumeric': 0.11274315204446209, 'fraction_numerical': 0.009130607383882492, 'mean_word_length': 4.766590389016018, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3302501', 'n_tokens_mistral': 725, 'n_tokens_neox': 704, 'n_words': 280}