Retour aux cas pratiques
SOAP/RESTAvancé
SOAP/REST - Appeler un service REST protégé par un token d’authentification
Scénario
Vous devez consommer un service REST protégé nécessitant un token d’authentification envoyé dans l’en-tête HTTP Authorization: Bearer <token>. L’endpoint /api/orders retourne la liste des commandes associées à un utilisateur connecté. Décrivez comment obtenir le token (via un endpoint /login), comment l’ajouter dans les en-têtes de la requête et comment gérer une erreur d’authentification (401 Unauthorized).
Compétences ciblées
RESTTokenAuthorizationBearerAuthentification