etape3
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
||||
/// Endpoints et variables OAuth 42 (fichier `.env` à la racine du package Flutter).
|
||||
abstract final class IntraConfig {
|
||||
static const String authorizeUrl = 'https://api.intra.42.fr/oauth/authorize';
|
||||
static const String tokenUrl = 'https://api.intra.42.fr/oauth/token';
|
||||
static const String apiBaseUrl = 'https://api.intra.42.fr/v2';
|
||||
|
||||
static String get clientId => dotenv.env['CLIENT_ID']?.trim() ?? '';
|
||||
static String get clientSecret => dotenv.env['CLIENT_SECRET']?.trim() ?? '';
|
||||
static String get redirectUri => dotenv.env['REDIRECT_URI']?.trim() ?? '';
|
||||
|
||||
static bool get isConfigured =>
|
||||
clientId.isNotEmpty && clientSecret.isNotEmpty && redirectUri.isNotEmpty;
|
||||
|
||||
/// Aide debug (écran auth) — ne pas afficher le secret complet.
|
||||
static String get clientIdSuffix {
|
||||
final id = clientId;
|
||||
if (id.length < 6) return '?';
|
||||
return id.substring(id.length - 6);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user