supertokens/docs

Python FastAPI CORSmiddleware code example out of date

T-Zoomer opened this issue · 1 comments

The second code example of the Python FastAPI docs, on CORS middleware, is out of date.
This bit of the docs is outdated: https://supertokens.com/docs/emailpassword/quick-setup/backend

See the FastAPI docs for the up to date examples: https://fastapi.tiangolo.com/tutorial/cors/.

I have got it working with the following code:

from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from supertokens_python.framework.fastapi import get_middleware

app = FastAPI()
app.add_middleware(get_middleware())

app.add_middleware(
    CORSMiddleware,
    allow_origins=[
        "http://127.0.0.1:3000"
    ],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

Thanks! We have made the fix for this :)