Aller au contenu principal

Auth API

Endpoints d'authentification pour l'API MyTelevision v2.

Base URL : /api/v2/auth

Endpoints

Vue d'ensemble

MethodeEndpointDescriptionAuth
POST/auth/registerInscriptionNon
POST/auth/loginConnexionNon
POST/auth/refreshRafraichir tokenNon
POST/auth/logoutDeconnexionOui
POST/auth/forgot-passwordMot de passe oublieNon
POST/auth/reset-passwordReinitialiser mot de passeNon
POST/auth/verify-emailVerifier emailNon
POST/auth/resend-verificationRenvoyer verificationNon
POST/auth/social/googleAuth GoogleNon
POST/auth/social/appleAuth AppleNon
POST/auth/social/facebookAuth FacebookNon
POST/auth/firebaseAuth Firebase (auto-detect)Non
POST/auth/social/linkLier compte socialOui
DELETE/auth/social/unlink/:providerDelier compte socialOui
GET/auth/social/accountsLister comptes liesOui
GET/auth/meUtilisateur courantOui

POST /auth/register

Creer un nouveau compte utilisateur.

POST /api/v2/auth/register
Content-Type: application/json

{
"email": "[email protected]",
"password": "Password123!",
"firstName": "John",
"lastName": "Doe"
}

Reponse 201 Created

{
"id": "uuid",
"email": "[email protected]",
"firstName": "John",
"lastName": "Doe"
}

POST /auth/login

Connexion avec email et mot de passe.

POST /api/v2/auth/login
Content-Type: application/json

{
"email": "[email protected]",
"password": "password123"
}

Reponse 200 OK

{
"accessToken": "eyJhbG...",
"refreshToken": "eyJhbG...",
"expiresIn": 900,
"tokenType": "Bearer",
"user": {
"id": "uuid",
"email": "[email protected]",
"role": "USER",
"subscription": {
"plan": "PREMIUM",
"expiresAt": "2025-12-31T23:59:59.000Z"
}
}
}

POST /auth/refresh

Rafraichir le token d'acces.

POST /api/v2/auth/refresh
Content-Type: application/json

{
"refreshToken": "eyJhbG..."
}

Reponse 200 OK

{
"accessToken": "eyJhbG...",
"expiresIn": 900
}

POST /auth/logout

Deconnexion et revocation du token.

POST /api/v2/auth/logout
Authorization: Bearer <token>

Reponse 204 No Content


POST /auth/social/google

Connexion avec Google via Firebase.

POST /api/v2/auth/social/google
Content-Type: application/json

{
"idToken": "firebase-id-token"
}

POST /auth/social/apple

Connexion avec Apple via Firebase.

POST /api/v2/auth/social/apple
Content-Type: application/json

{
"idToken": "firebase-id-token"
}

POST /auth/firebase

Connexion via Firebase avec auto-detection du provider.

POST /api/v2/auth/firebase
Content-Type: application/json

{
"idToken": "firebase-id-token"
}

GET /auth/me

Obtenir les informations de l'utilisateur courant.

GET /api/v2/auth/me
Authorization: Bearer <token>

Reponse 200 OK

{
"id": "uuid",
"email": "[email protected]",
"firstName": "John",
"lastName": "Doe",
"role": "USER",
"subscription": {
"plan": "PREMIUM",
"expiresAt": "2025-12-31T23:59:59.000Z"
}
}

Validation

Email

  • Format email valide
  • Maximum 255 caracteres

Mot de passe

  • Minimum 8 caracteres
  • Au moins 1 majuscule
  • Au moins 1 chiffre
  • Au moins 1 caractere special

Securite

MesureDetail
Hash des mots de passebcrypt (cost 12)
Signature JWTRS256
Rate limiting login5 tentatives / 15 min
SessionsStockees dans Redis
IP bindingOptionnel

Codes d'erreur

CodeMessageDescription
401Invalid credentialsEmail ou mot de passe incorrect
401Token expiredToken JWT expire
403Account suspendedCompte suspendu
409Email already existsEmail deja utilise
422Validation failedDonnees invalides
429Too many attemptsTrop de tentatives