can anyone help me to setup the quick start with fastapi? im using self hosted with docker, i alread...
v

Vrl

about 3 years ago
can anyone help me to setup the quick start with fastapi? im using self hosted with docker, i already try the docs and kinda work, but there's no routes, its like i dont do it here is my code:
python
import uvicorn
 
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

# Core Application Instance
app = FastAPI(
    title='Oasys Pipeliner',
    version='v1.0.0',
)

from supertokens_python import init as supertokens_init
from supertokens_python import InputAppInfo, SupertokensConfig
from supertokens_python.recipe import emailpassword, session
from supertokens_python.framework.fastapi import get_middleware
from supertokens_python import get_all_cors_headers

from supertokens_python.recipe import userroles

supertokens_init(
    app_info=InputAppInfo(
        app_name="oasys",
        api_domain="http://localhost:8000",
        website_domain="http://localhost:8000",
        api_base_path="/auth",
        website_base_path="/auth"
    ),
    supertokens_config=SupertokensConfig(
        # try.supertokens.com is for demo purposes. Replace this with the address of your core instance (sign up on supertokens.com), or self host a core.
        connection_uri="http://localhost:3567",
        # api_key="IF YOU HAVE AN API KEY FOR THE CORE, ADD IT HERE"
    ),
    framework='fastapi',
    recipe_list=[
        session.init(), # initializes session features
        emailpassword.init()
    ],
    mode='wsgi' # use wsgi if you are running using gunicorn
)

app.add_middleware(
    CORSMiddleware,
    allow_origins=[
        "http://localhost:8000"
    ],
    allow_credentials=True,
    allow_methods=["GET", "PUT", "POST", "DELETE", "OPTIONS", "PATCH"],
    allow_headers=["Content-Type"] + get_all_cors_headers(),
)

if __name__ == "__main__":
   uvicorn.run("main:app")
Hi, I got an error while trying to reset password for a user. It happens only when user clicks "Chan...
i

iamalvisng

about 2 years ago
Hi, I got an error while trying to reset password for a user. It happens only when user clicks "Change Passoword" after inputing New password and Confirm password.
TypeError: Body is unusable
at specConsumeBody (node:internal/deps/undici/undici:6630:15)
at NextRequest.json (node:internal/deps/undici/undici:6533:18)
at Object.getJSONBody (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/nextjs.js:71:38)
at PreParsedRequest.getJSONBody (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/framework/custom/framework.js:45:33)
at Object.passwordReset [as default] (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/recipe/emailpassword/api/passwordReset.js:36:36)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Recipe.handleAPIRequest (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/recipe/emailpassword/recipe.js:95:24)
at async Recipe.handleAPIRequest (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/recipe/thirdpartyemailpassword/recipe.js:49:24)
at async SuperTokens.middleware (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/supertokens.js:160:38)
at async eval (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/framework/custom/framework.js:134:28)
at async handleCall (webpack-internal:///(rsc)/./node_modules/.pnpm/supertokens-node@16.5.1/node_modules/supertokens-node/lib/build/nextjs.js:76:40)
at async /Users/path-to-project/node_modules/.pnpm/next@14.0.3_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:62609