gazelle_jwt 0.1.1 copy "gazelle_jwt: ^0.1.1" to clipboard
gazelle_jwt: ^0.1.1 copied to clipboard

Plugin for JSON Web Token (JWT) authentication in Gazelle, providing functionality to sign, verify, and handle JWT tokens during HTTP request processing.

Gazelle JWT Plugin #

The Gazelle JWT Plugin provides JSON Web Token (JWT) authentication capabilities for the Gazelle framework. This plugin allows you to easily secure your routes by integrating JWT-based authentication into your Gazelle application.

This plugin is based on dart_jsonwebtoken.

Getting started #

Installation #

To install the Gazelle JWT Plugin, add it to your pubspec.yaml file:

dependencies:
  gazelle_core: <latest-version>
  gazelle_jwt: <latest-version> 

Then, run dart pub get or flutter pub get to install the package.

Example usage #

Here's a quick example on how to use the GazelleJwtPlugin:

  final app = GazelleApp();
  await app.registerPlugin(GazelleJwtPlugin("supersecret"));

  app
    ..post(
      "/login",
      (request) async {
        return GazelleResponse(
          statusCode: 200,
          body: app.getPlugin<GazelleJwtPlugin>().sign({"test": "123"}),
        );
      },
    )
    ..get(
      "/hello_world",
      (request) async {
        return GazelleResponse(
          statusCode: 200,
          body: "Hello, World!",
        );
      },
      preRequestHooks: [app.getPlugin<GazelleJwtPlugin>().authenticationHook],
    );

  await app.start();
2
likes
0
pub points
0%
popularity

Publisher

verified publisherintales.it

Plugin for JSON Web Token (JWT) authentication in Gazelle, providing functionality to sign, verify, and handle JWT tokens during HTTP request processing.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

dart_jsonwebtoken, gazelle_core

More

Packages that depend on gazelle_jwt