authenticateWithOAuth method

Future<OAuthToken> authenticateWithOAuth({
  1. required List<String> scopes,
  2. String? state,
})

Initiate OAuth authentication flow

Implementation

Future<OAuthToken> authenticateWithOAuth({
  required List<String> scopes,
  String? state,
}) async {
  if (_oauthClient == null) {
    throw StateError('OAuth not configured for this transport');
  }

  final authUrl = await _oauthClient.getAuthorizationUrl(
    scopes: scopes,
    state: state,
  );

  // In a real implementation, you would:
  // 1. Open the auth URL in a browser
  // 2. Handle the redirect
  // 3. Extract the authorization code
  // 4. Exchange it for a token

  throw UnimplementedError(
    'OAuth flow requires platform-specific implementation. '
    'Authorization URL: $authUrl',
  );
}