From d963e2ed0e785bd1d1256b003ba33001c9a50750 Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Tue, 14 May 2024 13:20:25 +0200 Subject: [PATCH] MDL-81897 tool_mobile: Force partitioned cookies on inapp browser --- admin/tool/mobile/launch.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/admin/tool/mobile/launch.php b/admin/tool/mobile/launch.php index 346653a2fb0f0..827e0a03c3890 100644 --- a/admin/tool/mobile/launch.php +++ b/admin/tool/mobile/launch.php @@ -75,6 +75,11 @@ throw new moodle_exception('pluginnotenabledorconfigured', 'tool_mobile'); } +// If the user is using the inapp (embedded) browser, we need to set the Secure and Partitioned attributes to the session cookie. +if (\core_useragent::is_moodle_app()) { + \core\session\utility\cookie_helper::add_attributes_to_cookie_response_header('MoodleSession'.$CFG->sessioncookie, ['Secure', 'Partitioned']); +} + require_login(0, false); // Require an active user: not guest, not suspended.