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: 3 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 (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-13T13:16:39.000Z (9 months ago)
- Last Synced: 2024-02-13T15:09:09.769Z (9 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: 7
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - jod35/JWT-Auth-for-Flask - A repo I wrote demostrating how to implement JWT Authentication for Flask REST APIs (Python)
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```