dart_frog_header_auth 0.0.1 copy "dart_frog_header_auth: ^0.0.1" to clipboard
dart_frog_header_auth: ^0.0.1 copied to clipboard

Header-based authentication middleware for Dart Frog applications.

dart_frog_header_auth #

Pub Package GitHub

Header-based authentication middleware for Dart Frog applications.

Overview #

This package provides middleware for header-based authentication in Dart Frog applications. It validates user tokens from a specified header and makes the authenticated user available to handlers.

Usage #

To use this middleware, you can include it in your Dart Frog application as follows:

import 'package:dart_frog_header_auth/dart_frog_header_auth.dart';

Handler handleHeaderAuth(Handler handler) {
  return handler.use(requestLogger()).use(
    headerAuthentication<User>(
      authenticator: (context, token) async {
        final userRepository = context.read<UserRepository>();
        return await userRepository.userFromToken(token);
      },
    ),
  );
}

Documentation #

For detailed documentation and examples, refer to the API Documentation.

Installation #

Add the following to your pubspec.yaml:

dependencies:
  dart_frog_header_auth: ^latest_version

Replace ^latest_version with the latest version from pub.flutter-io.cn.

Changelog #

For a complete list of changes, see the Changelog.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

2
likes
140
points
30
downloads

Publisher

unverified uploader

Weekly Downloads

Header-based authentication middleware for Dart Frog applications.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dart_frog, dart_frog_auth, flutter, test

More

Packages that depend on dart_frog_header_auth