Activate 2FA Method

Activate 2FA Method

Device method requires additional steps to activate new 2FA method. You can activate the new method by providing the generated codes from the 2FA device.

code_1 and code_2 cannot be the same.

POST https://proxy.webshare.io/api/v2/twofactorauth/method/<ID>/activate/
ParameterTypeDescription
code_1string

Code generated by the 2FA device.

code_2string

Code generated by the 2FA device.

Request & Response

activate_2fa_method_request.py
import requests
 
response = requests.post(
    "https://proxy.webshare.io/api/v2/twofactorauth/method/<ID>/activate/",
    json={
        "code_1": "123456",
        "code_2": "987654",
    },
    headers={"Authorization": "Token "}
)
 
assert response.status_code == 200

The commands above return JSON structured like this:

response.json
{
  "id": 137,
  "type": "device",
  "active": True,
  "created_at": "2023-03-04T05:34:35.553059-08:00",
  "updated_at": "2023-03-04T05:34:35.553059-08:00",
}