Vrl
09/15/2022, 8:35 PMpython
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")
rp_st
09/16/2022, 4:04 AMrp_st
09/16/2022, 4:05 AMrp_st
09/16/2022, 4:05 AMVrl
09/16/2022, 12:21 PMVrl
09/16/2022, 12:22 PMVrl
09/16/2022, 12:23 PMrp_st
09/16/2022, 12:23 PMVrl
09/16/2022, 12:28 PMKShivendu
09/16/2022, 12:28 PMKShivendu
09/16/2022, 12:28 PMVrl
09/16/2022, 12:28 PMVrl
09/16/2022, 12:28 PMVrl
09/16/2022, 12:29 PMKShivendu
09/16/2022, 12:30 PMKShivendu
09/16/2022, 12:31 PMVrl
09/16/2022, 12:32 PMVrl
09/16/2022, 12:32 PMVrl
09/16/2022, 12:33 PMC:\Users\PTI>curl http://localhost:8000/auth/signin
{"detail":"Not Found"}
KShivendu
09/16/2022, 12:35 PMfetch("http://localhost:8000/auth/session/refresh", {method: "POST"}).then(res => res.text()).then(console.log)
try this in browserKShivendu
09/16/2022, 12:37 PMVrl
09/16/2022, 12:38 PMKShivendu
09/16/2022, 12:38 PMKShivendu
09/16/2022, 12:39 PMVrl
09/16/2022, 12:40 PMKShivendu
09/16/2022, 12:41 PMVrl
09/16/2022, 12:41 PMVrl
09/16/2022, 12:42 PMVrl
09/16/2022, 12:42 PMKShivendu
09/16/2022, 12:43 PMVrl
09/16/2022, 12:43 PM