nsj-flask-auth is a basic module designed for authenticating Flask applications within the Nasajon ecosystem. It provides tools for JWT-based authentication, integrating with Flask routes via decorators. Currently at version 0.11.1, its release cadence is tied to internal Nasajon project needs, typically with updates released as new features or fixes are required.
pip install nsj-flask-authVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize `nsj-flask-auth` with a Flask application, configure essential settings like the JWT secret and token header, and protect a route using the `@auth_required` decorator. Configuration is pulled from `app.config`, which can be populated via environment variables for security and flexibility. Run this, then access `/protected` with a valid JWT in the Authorization header to test.
Ensure `app.config['NSJ_AUTH_JWT_SECRET']` is correctly set with the exact secret key used by your token issuer. Use environment variables for production secrets.
Verify that `app.config['NSJ_AUTH_TOKEN_HEADER']` matches the header where clients send the token (e.g., 'Authorization'). Also, confirm `app.config['NSJ_AUTH_ALGORITHMS']` includes the algorithm used to sign the token.
Thoroughly review the GitHub repository's commit history or any available release notes before upgrading minor versions. Test applications extensively after any upgrade.