From 78d4c5d0d7f4ed2548d7e2006a6e317971c457e0 Mon Sep 17 00:00:00 2001 From: Edem Date: Thu, 14 Jul 2022 13:05:23 +0000 Subject: [PATCH 1/5] updated --- app/models.py | 1 + readMe.md | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/models.py b/app/models.py index 557263f..639dea1 100644 --- a/app/models.py +++ b/app/models.py @@ -13,6 +13,7 @@ class User(Base): password = Column(String, nullable=False) photo = Column(String, nullable=True) verified = Column(Boolean, nullable=False, server_default='False') + verification_code = Column(String, nullable=True, unique=True) role = Column(String, server_default='user', nullable=False) created_at = Column(TIMESTAMP(timezone=True), nullable=False, server_default=text("now()")) diff --git a/readMe.md b/readMe.md index b480aca..44a5eca 100644 --- a/readMe.md +++ b/readMe.md @@ -3,3 +3,7 @@ ### 1. RESTful API with Python & FastAPI: Access and Refresh Tokens [RESTful API with Python & FastAPI: Access and Refresh Tokens](https://codevoweb.com/restful-api-with-python-fastapi-access-and-refresh-tokens) + +### 2. RESTful API with Python & FastAPI: Send HTML Emails + +[RESTful API with Python & FastAPI: Send HTML Emails](https://codevoweb.com/restful-api-with-python-fastapi-send-html-emails) From 4469e5f600f2150c5ce5fbe1c12118a31469c9cc Mon Sep 17 00:00:00 2001 From: Edem Date: Mon, 25 Jul 2022 15:59:58 +0000 Subject: [PATCH 2/5] updated --- readMe.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readMe.md b/readMe.md index 44a5eca..8117b12 100644 --- a/readMe.md +++ b/readMe.md @@ -7,3 +7,7 @@ ### 2. RESTful API with Python & FastAPI: Send HTML Emails [RESTful API with Python & FastAPI: Send HTML Emails](https://codevoweb.com/restful-api-with-python-fastapi-send-html-emails) + +### 3. CRUD RESTful API Server with Python, FastAPI, and PostgreSQL + +[CRUD RESTful API Server with Python, FastAPI, and PostgreSQL](https://codevoweb.com/crud-restful-api-server-with-python-fastapi-and-postgresql) From 8413ce1dfb4e72ea0255850c89d14460106d4b24 Mon Sep 17 00:00:00 2001 From: Edem Date: Fri, 26 Aug 2022 20:31:30 +0000 Subject: [PATCH 3/5] updated --- alembic/versions/fa17ebbe2192_user_entity.py | 28 ++++++++++++++++++++ app/models.py | 1 - 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 alembic/versions/fa17ebbe2192_user_entity.py diff --git a/alembic/versions/fa17ebbe2192_user_entity.py b/alembic/versions/fa17ebbe2192_user_entity.py new file mode 100644 index 0000000..9046adc --- /dev/null +++ b/alembic/versions/fa17ebbe2192_user_entity.py @@ -0,0 +1,28 @@ +"""user-entity + +Revision ID: fa17ebbe2192 +Revises: 15770e820938 +Create Date: 2022-08-26 20:18:50.700242 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'fa17ebbe2192' +down_revision = '15770e820938' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + pass + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + pass + # ### end Alembic commands ### diff --git a/app/models.py b/app/models.py index 639dea1..557263f 100644 --- a/app/models.py +++ b/app/models.py @@ -13,7 +13,6 @@ class User(Base): password = Column(String, nullable=False) photo = Column(String, nullable=True) verified = Column(Boolean, nullable=False, server_default='False') - verification_code = Column(String, nullable=True, unique=True) role = Column(String, server_default='user', nullable=False) created_at = Column(TIMESTAMP(timezone=True), nullable=False, server_default=text("now()")) From ac0083aac4b3d73ffbfbe1cc8aba365c6aa9459f Mon Sep 17 00:00:00 2001 From: CODEVO Date: Sun, 2 Oct 2022 16:13:27 +0000 Subject: [PATCH 4/5] Update readMe.md --- readMe.md | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/readMe.md b/readMe.md index 8117b12..493a2d3 100644 --- a/readMe.md +++ b/readMe.md @@ -1,13 +1,43 @@ -# RESTful API with Python, FastAPI, Pydantic, SQLAlchemy and Docker +# RESTful API with Python,SQLAlchemy, & FastAPI: Access and Refresh Tokens -### 1. RESTful API with Python & FastAPI: Access and Refresh Tokens +In this article, you'll learn how to secure a FastAPI app by implementing access and refresh token functionalities using JSON Web Tokens (JWTs). We'll use the FastAPI JWT Auth package to sign, encode and decode the access and refresh JWT tokens. -[RESTful API with Python & FastAPI: Access and Refresh Tokens](https://codevoweb.com/restful-api-with-python-fastapi-access-and-refresh-tokens) +![RESTful API with Python,SQLAlchemy, & FastAPI: Access and Refresh Tokens](https://codevoweb.com/wp-content/uploads/2022/07/RESTful-API-with-Python-FastAPI-Access-and-Refresh-Tokens.webp) -### 2. RESTful API with Python & FastAPI: Send HTML Emails +## Topics Covered -[RESTful API with Python & FastAPI: Send HTML Emails](https://codevoweb.com/restful-api-with-python-fastapi-send-html-emails) +- Python FastAPI JWT Authentication Overview +- How to Setup FastAPI with PostgreSQL + - Setup FastAPI + - Initialize a Simple FastAPI Server +- Setting up Environment Variables in FastAPI +- Connect to the PostgreSQL Docker Container +- Installing the UUID OSSP PostgreSQL Extension +- Create Database Models with SQLAlchemy in FastAPI +- Creating Schemas with Pydantic in FastAPI +- Password Management with Bcrypt +- Configure the FastAPI JWT Auth Extension +- Creating the Authentication Controllers + - User Registration Controller + - User Sign-in Controller + - Refresh Access Token Controller + - Logout User Controller +- How to add Protected Routes +- Create a User Controller +- Adding the Routes to FastAPI Middleware Pipeline +- Database Migration with Alembic +- Testing the FastAPI JSON Web Token API -### 3. CRUD RESTful API Server with Python, FastAPI, and PostgreSQL +Read the entire article here: [https://codevoweb.com/restful-api-with-python-fastapi-access-and-refresh-tokens](https://codevoweb.com/restful-api-with-python-fastapi-access-and-refresh-tokens) -[CRUD RESTful API Server with Python, FastAPI, and PostgreSQL](https://codevoweb.com/crud-restful-api-server-with-python-fastapi-and-postgresql) +### 1. RESTful API with Python,SQLAlchemy, & FastAPI: Access and Refresh Tokens + +[RESTful API with Python, SQLAlchemy, & FastAPI: Access and Refresh Tokens](https://codevoweb.com/restful-api-with-python-fastapi-access-and-refresh-tokens) + +### 2. RESTful API with Python, SQLAlchemy, & FastAPI: Send HTML Emails + +[RESTful API with Python, SQLAlchemy & FastAPI: Send HTML Emails](https://codevoweb.com/restful-api-with-python-fastapi-send-html-emails) + +### 3. CRUD RESTful API Server with Python, FastAPI, SQLAlchemy, and PostgreSQL + +[CRUD RESTful API Server with Python, FastAPI, SQLAlchemy, and PostgreSQL](https://codevoweb.com/crud-restful-api-server-with-python-fastapi-and-postgresql) From 9414725cbf4b094cbdba4a513248ae2744f35613 Mon Sep 17 00:00:00 2001 From: CODEVO Date: Thu, 22 Dec 2022 17:14:43 +0000 Subject: [PATCH 5/5] updated --- requirements.txt | 62 +++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2c14003..095a868 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,46 +1,44 @@ -alembic==1.8.0 -anyio==3.6.1 -asgiref==3.5.2 -autopep8==1.6.0 -bcrypt==3.2.2 -certifi==2022.6.15 +aiosmtplib==1.1.7 +alembic==1.9.0 +anyio==3.6.2 +bcrypt==4.0.1 +blinker==1.5 +certifi==2022.12.7 cffi==1.15.1 -charset-normalizer==2.1.0 click==8.1.3 -colorama==0.4.5 +colorama==0.4.6 cryptography==3.4.8 dnspython==2.2.1 -email-validator==1.2.1 -fastapi==0.78.0 +email-validator==1.3.0 +fastapi==0.87.0 fastapi-jwt-auth==0.5.0 -greenlet==1.1.2 -h11==0.13.0 -httptools==0.4.0 -idna==3.3 +fastapi-mail==1.2.2 +greenlet==2.0.1 +h11==0.14.0 +httpcore==0.16.3 +httptools==0.5.0 +httpx==0.23.1 +idna==3.4 itsdangerous==2.1.2 Jinja2==3.1.2 -Mako==1.2.1 +Mako==1.2.4 MarkupSafe==2.1.1 -orjson==3.7.6 +orjson==3.8.3 passlib==1.7.4 -psycopg2==2.9.3 -pycodestyle==2.8.0 +psycopg2==2.9.5 pycparser==2.21 -pydantic==1.9.1 +pydantic==1.10.2 PyJWT==1.7.1 -python-dotenv==0.20.0 +python-dotenv==0.21.0 python-multipart==0.0.5 PyYAML==6.0 -requests==2.28.1 +rfc3986==1.5.0 six==1.16.0 -sniffio==1.2.0 -SQLAlchemy==1.4.39 -starlette==0.19.1 -toml==0.10.2 -typing_extensions==4.3.0 -tzdata==2022.1 -ujson==5.4.0 -urllib3==1.26.9 -uvicorn==0.17.6 -watchgod==0.8.2 -websockets==10.3 +sniffio==1.3.0 +SQLAlchemy==1.4.45 +starlette==0.21.0 +typing_extensions==4.4.0 +ujson==5.6.0 +uvicorn==0.20.0 +watchfiles==0.18.1 +websockets==10.4