HttpService
HTTP-Client-Wrapper für authentifizierte API-Anfragen an AuthSafe-Endpunkte.
Überblick
Der HttpService bietet einen komfortablen Wrapper um Axios für HTTP-Anfragen mit automatischer Bearer-Token-Injektion und Fehlerbehandlung. Vorkonfiguriert mit Base-URL, Content-Type, Cache-Control und Authorization-Headern mit einem Standard-Timeout von 10 Sekunden.
Grundlegende Verwendung
import { HttpService } from 'authsafe-ts';
const user = await oauthService.getUser();
const httpService = new HttpService(user?.access_token);
const userInfo = await httpService.get('/auth/userinfo');