Files
2026-09-30 08:24:20 +02:00

22 lines
574 B
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/// Résultat d’un `POST /oauth/token` (connexion ou refresh).
class OAuthTokenPair {
const OAuthTokenPair({
required this.accessToken,
this.refreshToken,
});
final String accessToken;
final String? refreshToken;
}
OAuthTokenPair? parseOAuthTokenResponse(Map<String, dynamic> json) {
final access = json['access_token'];
if (access is! String || access.isEmpty) return null;
final refresh = json['refresh_token'];
return OAuthTokenPair(
accessToken: access,
refreshToken: refresh is String && refresh.isNotEmpty ? refresh : null,
);
}