feat(api): added login redirect
This commit is contained in:
parent
2b76b00e9a
commit
07ee332b4c
2 changed files with 7 additions and 2 deletions
|
|
@ -178,4 +178,4 @@ async def create_oauth_tenant(fullname: str, email: str):
|
|||
cur.execute(cur.mogrify(query, params))
|
||||
r = cur.fetchone()
|
||||
|
||||
return users.authenticate_sso(email, email)
|
||||
return users.authenticate_sso(email, email)
|
||||
|
|
|
|||
|
|
@ -114,9 +114,14 @@ if True or config("MULTI_TENANTS", cast=bool, default=False) or not tenants.tena
|
|||
content = await signup.create_oauth_tenant(name, email)
|
||||
if "errors" in content:
|
||||
return content
|
||||
if content is None:
|
||||
return {"errors": ["null JWT"]}
|
||||
|
||||
refresh_token = content.pop("refreshToken")
|
||||
refresh_token_max_age = content.pop("refreshTokenMaxAge")
|
||||
response = JSONResponse(content=content)
|
||||
response = Response(
|
||||
status_code=status.HTTP_302_FOUND,
|
||||
headers={'Location': config("SITE_URL") + "/login?jwt=" + content})
|
||||
response.set_cookie(key="refreshToken", value=refresh_token, path="/api/refresh",
|
||||
max_age=refresh_token_max_age, secure=True, httponly=True)
|
||||
return response
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue