set cookie on oauth

This commit is contained in:
knst-kotov 2022-06-02 10:39:44 +03:00
parent b24a68e7e9
commit 6f2973c1b1
2 changed files with 5 additions and 3 deletions

View File

@ -83,5 +83,7 @@ async def oauth_authorize(request):
} }
user = Identity.identity_oauth(user_input) user = Identity.identity_oauth(user_input)
token = await Authorize.authorize(user, device="pc") token = await Authorize.authorize(user, device="pc")
redirect_uri = "%s%s" % (OAUTH_CALLBACK_URL, quote_plus(token))
return RedirectResponse(url = redirect_uri) response = RedirectResponse(url = OAUTH_CALLBACK_URL)
response.set_cookie("token", token)
return response

View File

@ -5,7 +5,7 @@ PORT = 8080
INBOX_SERVICE_PORT = 8081 INBOX_SERVICE_PORT = 8081
BACKEND_URL = environ.get("BACKEND_URL") or "https://localhost:8080" BACKEND_URL = environ.get("BACKEND_URL") or "https://localhost:8080"
OAUTH_CALLBACK_URL = environ.get("OAUTH_CALLBACK_URL") or "https://localhost:8080/auth/key-" OAUTH_CALLBACK_URL = environ.get("OAUTH_CALLBACK_URL") or "https://localhost:8080"
RESET_PWD_URL = environ.get("RESET_PWD_URL") or "https://localhost:8080/reset_pwd" RESET_PWD_URL = environ.get("RESET_PWD_URL") or "https://localhost:8080/reset_pwd"
DB_URL = environ.get("DATABASE_URL") or environ.get("DB_URL") or "sqlite:///db.sqlite3" DB_URL = environ.get("DATABASE_URL") or environ.get("DB_URL") or "sqlite:///db.sqlite3"