mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-17 11:46:30 -04:00
fiddle with logout
This commit is contained in:
@@ -62,6 +62,7 @@ def _get_user_email(access_token):
|
||||
user_info_url,
|
||||
headers=headers,
|
||||
)
|
||||
current_app.logger.info(f"HURRAY GOT USER ATTRIBUTES {user_attributes.json()}")
|
||||
user_email = user_attributes.json()["email"]
|
||||
return user_email
|
||||
|
||||
|
||||
@@ -14,18 +14,17 @@ def _sign_out_at_login_dot_gov():
|
||||
client_id = (
|
||||
f"client_id={os.getenv('LOGIN_DOT_GOV_CLIENT_ID')}"
|
||||
)
|
||||
post_logout_redirect_uri = "post_logout_redirect_api=http://localhost:6012/sign-in"
|
||||
state = f"state={str(uuid.uuid4())}"
|
||||
post_logout_redirect_uri = "post_logout_redirect_uri=http://localhost:6012/sign-in"
|
||||
|
||||
# TODO If I take this url and put it in the browser, login.gov sign out works properly
|
||||
# TODO But with this code it results in a 404 error message and we don't sign out from login.gov
|
||||
url = f"{base_url}&{client_id}&{post_logout_redirect_uri}&{state}"
|
||||
current_app.logger.info(f"URL={url}")
|
||||
response = requests.post(url)
|
||||
current_app.logger.info(f"GOT A RESPONSE {response}")
|
||||
url = f"{base_url}&{client_id}&{post_logout_redirect_uri}"
|
||||
current_app.logger.info(f"url={url}")
|
||||
response = requests.post(url, headers={'User-Agent': 'Custom'})
|
||||
current_app.logger.info(f"login.gov response: {response.text}")
|
||||
|
||||
|
||||
@main.route("/sign-out", methods=(["GET"]))
|
||||
@main.route("/sign-out", methods=(["GET", "POST"]))
|
||||
def sign_out():
|
||||
# An AnonymousUser does not have an id
|
||||
if current_user.is_authenticated:
|
||||
|
||||
Reference in New Issue
Block a user