Skip to main content
Complete 2FA login by verifying code.

Signature

VastAI.tfa_login(
    code: Optional[str] = None,
    method_type: Optional[str] = None,
    secret: Optional[str] = None,
    backup_code: Optional[str] = None,
    method_id: Optional[str] = None
) -> dict

Parameters

code
Optional[str]
2FA code from Authenticator app, SMS, or Email
method_type
Optional[str]
2FA Method type. Only use when you only have one method of this type
secret
Optional[str]
Secret token from previous login step (required for SMS or Email 2FA)
backup_code
Optional[str]
One-time backup code (alternative to regular 2FA code)
method_id
Optional[str]
2FA Method ID if you have more than one of the same type (‘id’ from tfa status)

Returns

dict

Example

from vastai import VastAI

client = VastAI(api_key="YOUR_API_KEY")
result = client.tfa_login()
print(result)