mod_auth_oauth_external: Expect XEP-0106 escaped username in PLAIN
This allows entering an email address as username in some clients by
escaping the @ as \40, enabling authentication against Mastodon
--- a/mod_auth_oauth_external/mod_auth_oauth_external.lua Wed May 10 12:39:05 2023 +0200
+++ b/mod_auth_oauth_external/mod_auth_oauth_external.lua Wed May 10 12:55:13 2023 +0200
@@ -37,6 +37,7 @@
if token_endpoint and allow_plain then
local map_username = function (username, _realm) return username; end; --jid.join; -- TODO configurable
function profile:plain_test(username, password, realm)
+ username = jid.unescape(username); -- COMPAT Mastodon
local tok, err = async.wait_for(self.profile.http_client:request(token_endpoint, {
headers = { ["Content-Type"] = "application/x-www-form-urlencoded; charset=utf-8"; ["Accept"] = "application/json" };
body = http.formencode({