signInWithProvider method

Future<void> signInWithProvider(
  1. BuildContext context,
  2. String provider,
  3. String redirectUrl,
  4. String blockchain,
)

Implementation

Future<void> signInWithProvider(BuildContext context, String provider,
    String redirectUrl, String blockchain) async {
  // Implement the sign-in process using the in-app browser and your authentication URL
  // Redirect the user to the external OAuth provider for authentication
  // After successful authentication, obtain the JWT and store it securely
  String authUrl =
      'https://auth-bice-mu.vercel.app/provider?provider=$provider&redirecturl=$redirectUrl&blockchain=$blockchain';

  Navigator.push(
    context,
    MaterialPageRoute(
      builder: (context) => AuthWebView(
        url: authUrl,
        onAuthenticated: (accessToken) async {
          // Store the access token securely
          final secureStorage = SecureStorageUtil();
          await secureStorage.setAccessToken(accessToken);
          await authenticationHandler();
        },
      ),
    ),
  );
}