data/services/oauth_service
library
Functions
-
buildAuthUrl({required String codeChallenge, required String state, required int port, required bool isManual, bool loginWithNeomageAi = false, bool inferenceOnly = false, String? orgUUID, String? loginHint, String? loginMethod})
→ String
-
Build the OAuth authorization URL.
-
createApiKey({required String accessToken, HttpClient? httpClient})
→ Future<String?>
-
Create and store an API key.
-
exchangeCodeForTokens({required String authorizationCode, required String state, required String codeVerifier, required int port, bool useManualRedirect = false, int? expiresIn, HttpClient? httpClient})
→ Future<OAuthTokenExchangeResponse>
-
Exchange authorization code for tokens.
-
fetchOAuthProfile({required String accessToken, HttpClient? httpClient})
→ Future<OAuthProfileResponse?>
-
Fetch profile info from the OAuth profile endpoint.
-
fetchProfileInfo({required String accessToken, HttpClient? httpClient})
→ Future<({String? accountCreatedAt, String? billingType, String? displayName, bool? hasExtraUsageEnabled, RateLimitTier? rateLimitTier, OAuthProfileResponse? rawProfile, String? subscriptionCreatedAt, SubscriptionType? subscriptionType})?>
-
Fetch profile info and extract subscription details.
-
fetchUserRoles({required String accessToken, HttpClient? httpClient})
→ Future<UserRolesResponse>
-
Fetch and store user roles.
-
generateCodeChallenge(String codeVerifier)
→ String
-
Generate the code challenge from the verifier (S256).
-
generateCodeVerifier()
→ String
-
Generate a random code verifier for PKCE.
-
generateState()
→ String
-
Generate a random state parameter for CSRF protection.
-
getOauthConfig()
→ OAuthConfig
-
-
isOAuthTokenExpired(int? expiresAt)
→ bool
-
Check if an OAuth token is expired (with 5 minute buffer).
-
parseScopes(String? scopeString)
→ List<String>
-
Parse a space-separated scope string into a list.
-
refreshOAuthToken({required String refreshToken, List<String>? requestedScopes, HttpClient? httpClient})
→ Future<OAuthTokens>
-
Refresh an OAuth token.
-
setOauthConfig(OAuthConfig config)
→ void
-
-
shouldUseNeomageAIAuth(List<String>? scopes)
→ bool
-
Check if the user has Neomage.ai authentication scope.
-
subscriptionTypeFromOrgType(String? orgType)
→ SubscriptionType?
-
Determine subscription type from organization type string.