Search packages, repositories and app categories

Package detailsv1.0.5

http_auth

Dart http middleware for HTTP Basic and Digest authentication

AndroidiOSWebmacOSWindowsLinux
30-day downloads
10.2K
Likes
38
Pub points
160

Install package

flutter pub add http_auth

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

http_auth is a Dart package providing HTTP middleware for implementing Basic and Digest authentication in Flutter and other Dart applications. It integrates seamlessly with the http package, enabling secure request handling by automatically managing authentication headers. The middleware supports both client-side authentication mechanisms, making it suitable for APIs requiring user credentials. It is designed for simplicity and compatibility across multiple platforms, including mobile, web, and desktop. The package is lightweight and focused on core authentication needs without additional features.

Use cases

  • Securing API requests with Basic auth
  • Implementing Digest authentication in web apps
  • Integrating with REST APIs requiring credentials
  • Handling authenticated HTTP calls in cross-platform apps
  • Automating authentication header management

Key features

  • Supports HTTP Basic and Digest authentication
  • Middleware integration with dart:io and http package
  • Cross-platform compatibility
  • Automatic header injection
  • Simple configuration and setup
  • Secure credential handling

Suitable for

  • Developers building apps with authenticated APIs
  • Projects requiring standard HTTP authentication
  • Cross-platform applications needing consistent auth behavior
  • Teams seeking lightweight authentication solutions
  • Apps using RESTful services with basic auth

Considerations

  • Does not support OAuth or token-based auth
  • Limited to Basic and Digest schemes only
  • Requires manual handling of session state
  • Not suitable for complex authentication workflows
  • No built-in UI components for login forms

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

pub package

http_auth

An http middleware for HTTP authentication (Basic/Digest).

The method (Basic or Digest) can optionally be autodetected.

Usage

HTTP Basic authentication:

    import 'package:http_auth/http_auth.dart';

    main() async {
      var client = http_auth.BasicAuthClient('user', 'passwd');
      var response = client.get('http://httpbin.org/basic-auth/user/passwd');
    }

HTTP Digest authentication:

    import 'package:http_auth/http_auth.dart';

    main() async {
      var client = http_auth.DigestAuthClient('user', 'passwd');
      var response = client.get('http://httpbin.org/digest-auth/auth/user/passwd');
    }

Automatic detection of the protocol (Basic or Digest):

    import 'package:http_auth/http_auth.dart';

    main() async {
      var client = http_auth.NegotiateAuthClient('user', 'passwd');
      var response = client.get('http://httpbin.org/digest-auth/auth/user/passwd');
    }

Synchronous usage is also possible (see the example).

Categories

Dependencies

Dependency list 3 items

Source repository

Projects using this package