This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| import time | |
| from sqlalchemy.exc import OperationalError | |
| from sqlalchemy.orm import Session | |
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from starlette.middleware.sessions import SessionMiddleware | |
| from .models.base import Base | |
| from .models.user import User | |
| from .models.product import Product |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| authlib | |
| httpx | |
| itsdangerous |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ADD THIS TO YOUR ENV FILE | |
| AUTH0_DOMAIN=dev-jd3knmffgk15hi2j.us.auth0.com | |
| AUTH0_CLIENT_ID=7m4ruBFVdU0CMVfkur1JrUAy8BbKmLtK | |
| AUTH0_CLIENT_SECRET=dZ2Apk5a3NzKOSFyvf6MoNQyQBM1PQRBiJmivRbbeVbjdeM9GZNEjK_svaXM0Sqy | |
| AUTH0_CALLBACK_URL=http://localhost:8000/oauths/callback | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from authlib.integrations.starlette_client import OAuth | |
| # get env | |
| AUTH0_DOMAIN=os.getenv("AUTH0_DOMAIN") | |
| AUTH0_CLIENT_ID=os.getenv("AUTH0_CLIENT_ID") | |
| AUTH0_CLIENT_SECRET=os.getenv("AUTH0_CLIENT_SECRET") | |
| AUTH0_CALLBACK_URL=os.getenv("AUTH0_CALLBACK_URL") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from app.routes.database import get_db | |
| from app.schema.users_schema import UserCreate, UserData, UserResponse, UserUpdate, UserResponseBack | |
| from datetime import datetime | |
| from typing import Annotated | |
| from fastapi import APIRouter, Depends, status, HTTPException, Request | |
| from fastapi.responses import RedirectResponse | |
| from sqlalchemy.orm import Session, defer | |
| from sqlalchemy.exc import IntegrityError | |
| from app.models.user import User | |
| from app.auth.jwt import create_access_token |