# 2 factor login for experience user

**URL:** <https://forums.losant.com/t/2-factor-login-for-experience-user/2832>\
**Category:** Help\
**Tags:** experience\
**Created:** [April 16, 2020, 12:04pm UTC](https://forums.losant.com/t/2-factor-login-for-experience-user/2832 "2020-04-16T12:04:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lars\_Andersson](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@Lars\_Andersson](https://forums.losant.com/u/Lars_Andersson)\
**Post date:** [April 16, 2020, 12:04pm UTC](https://forums.losant.com/t/2-factor-login-for-experience-user/2832/1 "2020-04-16T12:04:30Z")

</div>

Can 2 factor login be setup for an experience user?

---

<div class="post-metadata">

**Author:** ![JuliaKempf](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/juliakempf/32/2446_2.png) [@JuliaKempf](https://forums.losant.com/u/JuliaKempf)\
**Post date:** [April 16, 2020, 2:39pm UTC](https://forums.losant.com/t/2-factor-login-for-experience-user/2832/2 "2020-04-16T14:39:43Z")

</div>

Hi @Lars_Andersson,

The logic for two-factor authentication could be configured within a workflow, did you have a specific method or service in mind?

There is also an interesting forum post where a user created a login and CAPTCHA within their experience. It may provide some inspiration, so if you’re interested, you can check it out [here](https://forums.losant.com/t/recaptcha-nocaptcha-implementation-security/1701)!

Thanks,  
Julia

---

<div class="post-metadata">

**Author:** ![Josh\_Bell](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/josh_bell/32/2554_2.png) [@Josh\_Bell](https://forums.losant.com/u/Josh_Bell)\
**Post date:** [May 11, 2020, 10:25pm UTC](https://forums.losant.com/t/2-factor-login-for-experience-user/2832/3 "2020-05-11T22:25:17Z")

</div>

Hi @JuliaKempf  
I’m also interested in how to do MFA (two-factor authentication) for experience users. Can it be done using Microsoft Authenticator or Google?

thanks

Josh

---

<div class="post-metadata">

**Author:** ![anaptfox](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/anaptfox/32/873_2.png) [@anaptfox](https://forums.losant.com/u/anaptfox)\
**Post date:** [May 12, 2020, 9:59pm UTC](https://forums.losant.com/t/2-factor-login-for-experience-user/2832/6 "2020-05-12T21:59:01Z")

</div>

@Josh_Bell, @Lars_Andersson,

We’ve been doing some thinking and research for you.

These are the general instructions but I’m adding this to our list of examples to make. You should be able to accomplish 2FA through a couple of methods:

## SMS & Email

This route requires some effort. Depending on your preference of SMS and Email (the process would be very similar), you can implement your own 2FA flow in Losant.

You could use Twilio or SendGrid as the services to send the messages.

You would need to build at least two experience workflows.

1. Generate Token Workflow - This workflow will generate the token for the user, and send via email or SMS.
2. Verify Token Workflow - This workflow accepts a token from a user, verifies it, and set their authentication cookie.

I recommend using [JWT Tokens](https://docs.losant.com/workflows/logic/jwt-create/) for the secrets. You can learn more about JWT Tokens [here](https://jwt.io/). You will have to store a secret or one-time code for the user. The best place for this is [Experience User Tags](https://docs.losant.com/experiences/users/#user-tags).

## 2FA via Rest API

I think this one would be the easiest to integrate. You can use the [HTTP Node](https://docs.losant.com/workflows/data/http/) to talk to the Authy API.

> **[Authy API](https://www.twilio.com/docs/authy/api)**
>
> Twilio Authy Two-Factor Authentication API Overview, with authentication, endpoint and formatting details. Includes links to Helper Libraries and SDKs.

---

<div class="post-metadata">

**Author:** ![jbwaihe](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@jbwaihe](https://forums.losant.com/u/jbwaihe)\
**Post date:** [November 1, 2020, 9:19pm UTC](https://forums.losant.com/t/2-factor-login-for-experience-user/2832/7 "2020-11-01T21:19:05Z")

</div>

I’m trialing the 2FA verification service with Twilio. I managed to use their service with cURL from their documentation.  
But I’m having issues with the formatting in the Losant HTTP node. Can you check what I’m doing wrong ? I get a 400 error with the message “Missing required parameter To in the post body”

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/6/663d0565000181a86dc7dbe7419a78f9cb42e888.png)

---

<div class="post-metadata">

**Author:** ![anaptfox](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/anaptfox/32/873_2.png) [@anaptfox](https://forums.losant.com/u/anaptfox)\
**Post date:** [November 2, 2020, 2:23pm UTC](https://forums.losant.com/t/2-factor-login-for-experience-user/2832/10 "2020-11-02T14:23:41Z")

</div>

Hey @jbwaihe,

Could you please provide a link to the documentation you’re referring to?

It looks like one thing in your string is “%2B” which is the `+` symbol when URL encoded. Have you tried using the `+` symbols directly?

---

<div class="post-metadata">

**Author:** ![jbwaihe](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@jbwaihe](https://forums.losant.com/u/jbwaihe)\
**Post date:** [November 6, 2020, 2:18am UTC](https://forums.losant.com/t/2-factor-login-for-experience-user/2832/11 "2020-11-06T02:18:15Z")

</div>

Yes I did try + directly also.

The documentation I referred to is here:

> **[Verifications](https://www.twilio.com/docs/verify/api/verification)**
