Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jod35/jwt-auth-for-flask
A repo I wrote demostrating how to implement JWT Authentication for Flask REST APIs
https://github.com/jod35/jwt-auth-for-flask
flask flask-jwt-extended flask-sqlalchemy jwt-authentication
Last synced: about 2 months ago
JSON representation
A repo I wrote demostrating how to implement JWT Authentication for Flask REST APIs
- Host: GitHub
- URL: https://github.com/jod35/jwt-auth-for-flask
- Owner: jod35
- Created: 2023-08-26T06:40:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-13T13:16:39.000Z (11 months ago)
- Last Synced: 2024-08-14T07:07:39.208Z (4 months ago)
- Topics: flask, flask-jwt-extended, flask-sqlalchemy, jwt-authentication
- Language: Python
- Homepage: https://www.youtube.com/playlist?list=PLEt8Tae2spYmugodsDflw5U8zp1yzSPgU
- Size: 16.6 KB
- Stars: 15
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JWT Authentication for Flask
This is source code for a video I made when demonstrating how to implement JWT Authentication for Flask REST APIs. This videos series walks through the following.
- Project SetUp
- Database Management with Flask-SQLAlchemy
- User Account Creation
- JWT Authentication with Flask-JWT-Extended# How to run the project
1. Clone the repository
```bash
git clone https://github.com/jod35/JWT-Auth-for-Flask.git && cd JWT-Auth-for-Flask.git/
```2. Install requirements
```bash
pip install requirements.txt
```3. Create a `.env` file and set environment variables
```
FLASK_SECRET_KEY=
FLASK_DEBUG=
FLASK_SQLALCHEMY_DATABASE_URI=
FLASK_SQLALCHEMY_ECHO=
```4. Create a `FLASK_APP` environment variable.
```bash
export FLASK_APP=src/
```5. Create the database by running
```bash
flask shell
```6. In the interactive shell run the following
```
Python 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)] on win32
App: main
Instance: C:\Users\jod35\Documents\coding\JWT Auth flask\instance
>>> from models import User
>>> db.create_all()
```7. Finally run the application with
```flask run```