Hi! I'm having an issue when i try to sign up with a thirdparty provider. -> Issue: I'm getting a FI...
p

pvharmo

over 3 years ago
Hi! I'm having an issue when i try to sign up with a thirdparty provider. -> Issue: I'm getting a FIELD_ERROR Request failed with status code 401 when I try to sign up with a Google account. What's strange is that I already managed to sign up and sign in using an other Google account. -> Frontend SDK used: supertokens-website, v10.0.8) -> Backend SDK used: supertokens-node, v9.2.1 -> Debug logs from the backend SDK (the message with log is too long for Discord so I removed the time of the request):
{message: "middleware: requestRID is: thirdpartyemailpassword", file: "node_modules/supertokens-node/lib/build/supertokens.js:172:26" sdkVer: "9.1.2"}
{message: "middleware: Checking recipe ID for match: thirdpartyemailpassword", file: "node_modules/supertokens-node/lib/build/supertokens.js:181:34" sdkVer: "9.1.2"}
 {message: "middleware: Matched with recipe ID: thirdpartyemailpassword", file: "node_modules/supertokens-node/lib/build/supertokens.js:194:30" sdkVer: "9.1.2"}
{message: "middleware: Request being handled by recipe. ID is: /signinup", file: "node_modules/supertokens-node/lib/build/supertokens.js:206:30" sdkVer: "9.1.2"}
{message: "middleware: Started", file: "node_modules/supertokens-node/lib/build/supertokens.js:158:26" sdkVer: "9.1.2"}
{message: "middleware: requestRID is: anti-csrf", file: "node_modules/supertokens-node/lib/build/supertokens.js:172:26" sdkVer: "9.1.2"}
{message: "middleware: Checking recipe ID for match: thirdpartyemailpassword", file: "node_modules/supertokens-node/lib/build/supertokens.js:220:34" sdkVer: "9.1.2"}
{message: "middleware: Request being handled by recipe. ID is: /authorisationurl", file: "node_modules/supertokens-node/lib/build/supertokens.js:225:38" sdkVer: "9.1.2"}
{message: "Sending response to client with status code: 200", file: "node_modules/supertokens-node/lib/build/utils.js:90:14" sdkVer: "9.1.2"}

response : { status: 'FIELD_ERROR', error: 'Request failed with status code 401' }
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")