fiddle with logout

This commit is contained in:
Kenneth Kehl
2023-10-20 09:34:39 -07:00
parent 7ca258b547
commit 782cff2d5f
2 changed files with 7 additions and 7 deletions
+1
View File
@@ -62,6 +62,7 @@ def _get_user_email(access_token):
user_info_url, user_info_url,
headers=headers, headers=headers,
) )
current_app.logger.info(f"HURRAY GOT USER ATTRIBUTES {user_attributes.json()}")
user_email = user_attributes.json()["email"] user_email = user_attributes.json()["email"]
return user_email return user_email
+6 -7
View File
@@ -14,18 +14,17 @@ def _sign_out_at_login_dot_gov():
client_id = ( client_id = (
f"client_id={os.getenv('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" post_logout_redirect_uri = "post_logout_redirect_uri=http://localhost:6012/sign-in"
state = f"state={str(uuid.uuid4())}"
# TODO If I take this url and put it in the browser, login.gov sign out works properly # 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 # 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}" url = f"{base_url}&{client_id}&{post_logout_redirect_uri}"
current_app.logger.info(f"URL={url}") current_app.logger.info(f"url={url}")
response = requests.post(url) response = requests.post(url, headers={'User-Agent': 'Custom'})
current_app.logger.info(f"GOT A RESPONSE {response}") 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(): def sign_out():
# An AnonymousUser does not have an id # An AnonymousUser does not have an id
if current_user.is_authenticated: if current_user.is_authenticated: