Last updated:
0 purchases
pharaoh jwt auth
pharaoh_jwt_auth 🪠#
This module provides Pharaoh middleware for validating JWTs (JSON Web Tokens) through the dart_jsonwebtoken
package.
The decoded JWT payload is available on the request object via req.auth.
Installing: #
In your pubspec.yaml
dependencies:
pharaoh: ^0.0.5+6
pharaoh_jwt_auth:
copied to clipboard
Basic Usage: #
import 'package:pharaoh/pharaoh.dart';
import 'package:pharaoh_jwt_auth/pharaoh_jwt_auth.dart';
void main() async {
final app = Pharaoh();
app.use(jwtAuth(secret: () => SecretKey('some-secret-key')));
app.get('/', (req, res) => res.ok('Hello World'));
await app.listen();
}
copied to clipboard
The package also exports the dart_jsonwebtoken package for your usage outside of this library.
Tests #
The cases in the pharaoh_jwt_auth_test.dart are also used for automated testing. So if you want
to contribute or just make sure that the package still works, simply run:
dart test
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.