Function authy::api::user::create [] [src]

pub fn create(
    client: &Client,
    email: &str,
    country_code: u16,
    phone: &str,
    send_instructions: bool
) -> Result<(Status, UserNew), AuthyError>

Creates a new Authy user.

Before you can secure a user's login you need to create an Authy user. Authy requires you send an email, phone number and country code for each Authy user. In response you get an Authy ID which you must then store with your user's profile in your own application.

Note: You need to store the unchanging authy_id against the user profile in your database or directory: You will use this ID every time you are verifying the user's token. For privacy reasons, your users can change their phone number registered with Authy without your knowledge by using the Authy mobile or desktop app or the Authy.com phone change security review. Their Authy ID may be used for other services as well.

A user can have multiple e-mails but only one cellphone. Two separate api calls to register a user with the same cellphone and different e-mails will return the same authy_id and store both emails for that Authy user.

Please see the Authy documentation for more details: https://www.twilio.com/docs/api/authy/authy-totp#enabling-two-factor

Example:

let mut c = Client::new(API_URL, API_KEY);
let (status, user) = user::new(&c, "user@domain.com", 54, "317-338-9302", false).expect("User to be created");

println!("My new authy user is: {}", user.id);