Hansi
09/15/2022, 5:20 PM/api/*
are forwarded to my Python Flask API, which is where the backend SuperTokens SDK is implemented.
As mentioned, it worked just before switching to nginx but now all requests to localhost:80/api/auth
and direct ones to the api localhost:8080/auth
all return the 404
from this function:
@app.route('/', defaults={'u_path': ''})
@app.route('/<path:u_path>')
def catch_all(u_path: str):
abort(404)
I am able to reach other API endpoints just fine through for example http://localhost/api/hello
.
nginx
server {
listen 80;
root /gg-host/build;
index index.html;
location / {
try_files $uri $uri/ =404;
add_header Cache-Control "no-cache";
}
location /static {
expires 1y;
add_header Cache-Control "public";
}
location /api {
include proxy_params;
proxy_pass http://api:8080;
}
}
Python Flask app_info
app_info=InputAppInfo(
app_name="GG-Host",
api_domain="http://localhost",
website_domain="http://localhost",
api_base_path="/api/auth",
website_base_path="/api/auth"
)
React app_info
appInfo: {
appName: "GG-Host",
apiDomain: "http://localhost",
websiteDomain: "http://localhost",
apiBasePath: "/api/auth",
websiteBasePath: "/api/auth"
}
rp
09/15/2022, 5:41 PMVrl
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")
gopi
09/15/2022, 11:26 PMcernan
09/16/2022, 12:08 AMHandling of 401 status code and refreshing the session (steps (4) till (8)) happens automatically via our frontend SDK.
However I don't seem to be getting any automatic retry of the api call from step 7. It technically works by catching a 401 error on the api call itself and using attemptRefreshingSession()
, but it sounds like that should happen automaticallypx1
09/16/2022, 1:08 AMpx1
09/16/2022, 1:08 AMrp
09/16/2022, 4:04 AMrp
09/16/2022, 4:06 AMrp
09/16/2022, 4:07 AMrp
09/16/2022, 4:07 AMZaker237
09/17/2022, 6:34 PMAdiGutner
09/18/2022, 12:35 PMrp
09/18/2022, 1:09 PMAyush019
09/18/2022, 1:45 PMAyush019
09/18/2022, 1:47 PMmuhajirdev
09/19/2022, 2:57 AMsRefreshToken
cookie.
What would be useful information I can provide?muhajirdev
09/19/2022, 10:57 AMJonny
09/19/2022, 11:01 AMJonny
09/19/2022, 11:01 AMJonny
09/19/2022, 11:10 AMrp
09/19/2022, 11:45 AMrp
09/19/2022, 11:46 AMrp
09/19/2022, 11:47 AMrezaamya
09/19/2022, 3:22 PMrp
09/19/2022, 3:23 PMrp
09/19/2022, 3:31 PMAbhishek Sachdeva
09/19/2022, 4:56 PMconnectionURI: "https://try.supertokens.com",
with
connectionURI: "http://localhost:8080",
in api-server.js
After clicking "**continue with google**", I got redirected to "supertokens.com", then to the google login screen. I don't see any logs in core
service after initiating the login flow. Is it still sending request to try.supertokens.com somewhere? Why is it redirecting to supertokens.com? Is it hard-coded somewhere?muhajirdev
09/19/2022, 4:57 PMonUserCreated
function?
basically like a hook, when a user created, do something
I know it's possible to do in consumeCode
, thirdPartySignInUp
. Just wondering if there's a cleaner way to do thisrp
09/19/2022, 5:22 PM