---
title: "Two Factor authentication"
canonical: "https://onesaitplatform.refined.site/space/DOCT/2220849593/Two%20Factor%20authentication"
format: markdown
---
> ℹ️ This functionality is currently available only for users with role ADMINISTRATOR.


There’s a two factor authentication (2FA) mechanism available for administrators on the platform. When enabled, the authentication flow of the platform is changed to fit the 2FA standard. 

# How it works

After successful log in (user credentials), a mail is sent by the platform to the user with a OTP (one-time-password) code. In order to complete the authentication process, user will need to provide this code to the platform.

The code will be valid for 5 minutes (This can be changed).

![image](media://02536d4f-797a-4ebc-996b-37c0c44e3c7e)

![image](media://e5714e3c-9ee6-4a51-ad86-77b475a2afef)

![image](media://28db7421-d708-4072-9e08-acf4a6a19018)


## How to enable 2FA


To enable this security mechanism, the environment variable **TWOFA_ENABLED** must be set to true on the **controlpanel service.**


![image](media://156f7916-86ed-44d5-98aa-63ef8ddef877)