From 91fa38f0560d8a37d62bff711f88f8c98c9ad367 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 16 Mar 2015 18:07:57 +0100 Subject: [PATCH] Work around Facebook not reading the URI RFC --- .../install/files/lib/action/FacebookAuthAction.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php b/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php index 8f66cc8793..bec9de7e3f 100644 --- a/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php +++ b/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php @@ -36,6 +36,13 @@ class FacebookAuthAction extends AbstractAction { parent::execute(); $callbackURL = LinkHandler::getInstance()->getLink('FacebookAuth'); + + // Work around Facebook performing an illegal substitution of the Slash + // by '%2F' when entering redirect URI (RFC 3986 sect. 2.2, sect. 3.4) + $callbackURL = preg_replace_callback('/(?<=\?).*/', function ($matches) { + return rawurlencode($matches[0]); + }, $callbackURL); + // user accepted the connection if (isset($_GET['code'])) { try { -- 2.20.1