# Changement de numéro de téléphone

Toutes les opérations liées à la création et la validation d'un compte.


# Connexion au compte

Endpoint

POST api/v1/auth/login

# Body

Paramètre Type Requis Description
identifier string Oui Adresse email ou numéro de téléphone de l'utilisateur
password string Oui Mot de passe du compte
device_type string Non Type d'appareil (Mobile, Tablette, Navigateur)
device_name string Non Nom de l'appareil
device_os string Non Système d'exploitation
device_fingerprint string Non Identifiant unique de l'appareil

# Exemple de requête.

{
  "identifier": "user@example.com",
  "password": "password123",
  "device_type": "Mobile",
  "device_name": "SAMSUNG GALAXY A13",
  "device_os": "Android",
  "device_fingerprint": "HJJKJ6-BKJLOI-12"
}

# Réponse

{
    "status": 200,
    "access_token": "eyJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50X2lkIjo2LCJkZXZpY2VfaWQiOjUsInNlc3Npb25fdXVpZCI6ImY3Njg5OWI1LTgwMjMtNGFlZi1hZWFlLTdmMTU0MTcxMTY4YSIsImV4cCI6MTc3MjgyMTU0MywiaXNzIjoiQXV0aFNlcnZpY2UiLCJhdWQiOiJjbGllbnQiLCJqdGkiOiIwZGVlMGFkYi1jYTBkLTQ0Y2MtODZlNS0zNmI4YTEwMDEzNTIifQ.Wj_I4YFjOQEtM07GLLt9HtZ1rEFghePfcwMjuJyHVrY",
    "refresh_token": "36cc0de8ff5be29406a38f0bbe3a6451baa53c0877a1a8dd6f1fd44bfabf8e27",
    "account": {
        "failed_attempts": 0,
        "id": 6,
        "uuid": "58356bc8-0639-4289-88e8-f64b7ca54501",
        "email": "salut.amos@gmail.com",
        "phone": null,
        "password_digest": "$2a$12$mKUf93E7uW4vt.YOHcrzGeRRAudrsXypr6dYkvGg6L.BfBAwfcwNm",
        "accountable_type": "Customer",
        "accountable_id": 5,
        "role_id": 4,
        "remember_created_at": null,
        "sign_in_count": 0,
        "current_sign_in_at": null,
        "last_sign_in_at": null,
        "current_sign_in_ip": null,
        "last_sign_in_ip": null,
        "account_confirmed_at": "2026-03-06T17:25:36.316Z",
        "account_confirmed": true,
        "unlock_token": null,
        "locked_at": null,
        "two_factor_enabled": false,
        "provider": "local",
        "provider_uid": null,
        "created_at": "2026-03-06T15:03:05.533Z",
        "updated_at": "2026-03-06T17:25:36.321Z"
    }
}

# Demande de code 2FA pour la connexion

Endpoint

POST /api/v1/auth/2fa/request-otp

# Body

Paramètre Type Requis Description
identifier string Oui Adresse e-mail ou numéro de téléphone du compte

# Exemple de requête

{

  "identifier": "john@example.com",

}

# Réponse

{
    "status": 201,
    "message": "Un code OTP de 6 chiffres a été renvoyé."
}


# Confirmation 2FA pour la connexion

Endpoint

POST /api/v1/auth/2fa/verify

# Body

Paramètre Type Requis Description
identifier string Oui Adresse e-mail ou numéro de téléphone du compte
device_type string Non Type d'appareil (Mobile, Tablette, Navigateur)
device_name string Non Nom de l'appareil
device_os string Non Système d'exploitation
device_fingerprint string Non Identifiant unique de l'appareil
otp string Oui Code OTP de confirmation

# Exemple de requête

{

  "identifier": "user@example.com",
  "password": "password123",
  "device_type": "Mobile",
  "device_name": "SAMSUNG GALAXY A13",
  "device_os": "Android",
  "device_fingerprint": "HJJKJ6-BKJLOI-12",
  "otp": "12345"

}

# Réponse

{
    "status": 200,
    "access_token": "eyJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50X2lkIjo2LCJkZXZpY2VfaWQiOjUsInNlc3Npb25fdXVpZCI6ImY3Njg5OWI1LTgwMjMtNGFlZi1hZWFlLTdmMTU0MTcxMTY4YSIsImV4cCI6MTc3MjgyMTU0MywiaXNzIjoiQXV0aFNlcnZpY2UiLCJhdWQiOiJjbGllbnQiLCJqdGkiOiIwZGVlMGFkYi1jYTBkLTQ0Y2MtODZlNS0zNmI4YTEwMDEzNTIifQ.Wj_I4YFjOQEtM07GLLt9HtZ1rEFghePfcwMjuJyHVrY",
    "refresh_token": "36cc0de8ff5be29406a38f0bbe3a6451baa53c0877a1a8dd6f1fd44bfabf8e27",
    "account": {
        "failed_attempts": 0,
        "id": 6,
        "uuid": "58356bc8-0639-4289-88e8-f64b7ca54501",
        "email": "salut.amos@gmail.com",
        "phone": null,
        "password_digest": "$2a$12$mKUf93E7uW4vt.YOHcrzGeRRAudrsXypr6dYkvGg6L.BfBAwfcwNm",
        "accountable_type": "Customer",
        "accountable_id": 5,
        "role_id": 4,
        "remember_created_at": null,
        "sign_in_count": 0,
        "current_sign_in_at": null,
        "last_sign_in_at": null,
        "current_sign_in_ip": null,
        "last_sign_in_ip": null,
        "account_confirmed_at": "2026-03-06T17:25:36.316Z",
        "account_confirmed": true,
        "unlock_token": null,
        "locked_at": null,
        "two_factor_enabled": false,
        "provider": "local",
        "provider_uid": null,
        "created_at": "2026-03-06T15:03:05.533Z",
        "updated_at": "2026-03-06T17:25:36.321Z"
    }
}