http_auth 1.0.4 copy "http_auth: ^1.0.4" to clipboard
http_auth: ^1.0.4 copied to clipboard

Dart http middleware for HTTP Basic and Digest authentication

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');
    }
copied to clipboard

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');
    }
copied to clipboard

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');
    }
copied to clipboard

Synchronous usage is also possible (see the example).

37
likes
150
points
12.2k
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.14 - 2025.03.29

Dart http middleware for HTTP Basic and Digest authentication

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

convert, crypto, http

More

Packages that depend on http_auth