luke898
03/25/2022, 9:27 AMjson
{
"detail": "Not Found"
}
This is my python code base
python
from supertokens_python import init, InputAppInfo, SupertokensConfig
from supertokens_python.recipe import emailpassword, session
from supertokens_python import get_all_cors_headers
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from supertokens_python.framework.fastapi import Middleware
init(
app_info=InputAppInfo(
app_name="test",
api_domain="http://localhost:8000",
website_domain="http://localhost:3000",
api_base_path="/api",
website_base_path="/auth"
),
supertokens_config=SupertokensConfig(
connection_uri="https://try.supertokens.com",
# api_key=""
),
framework='fastapi',
recipe_list=[
session.init(), # initializes session features
emailpassword.init()
],
mode='asgi' # use wsgi if you are running using gunicorn
)
app = FastAPI()
app.add_middleware(Middleware)
# TODO: Add APIs
app = CORSMiddleware(
app=app,
allow_origins=[
"http://localhost:3000"
],
allow_credentials=True,
allow_methods=["GET", "PUT", "POST", "DELETE", "OPTIONS", "PATCH"],
allow_headers=["Content-Type"] + get_all_cors_headers(),
)
running via: uvicorn main:app --reload --host=0.0.0.0 --port=3001