From 1e4ec6c1323c6174347ead1b101c2063c32c83dd Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Thu, 30 Nov 2023 11:15:34 -0500 Subject: [PATCH] need to encode username in the passed token too --- source/symmetry/imap/request.d | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/symmetry/imap/request.d b/source/symmetry/imap/request.d index a501904..cde2952 100644 --- a/source/symmetry/imap/request.d +++ b/source/symmetry/imap/request.d @@ -192,8 +192,10 @@ Session login(Session session) { rl = ImapStatus.preAuth; } else { if (session.capabilities.has(Capability.oauth2) && login.oauthToken.strip.length) { - version (Trace) stderr.writefln("cram"); - t = session.check!sendRequest(format!"AUTHENTICATE XOAUTH2 %s"(login.oauthToken.strip)); + version (Trace) stderr.writefln("oauth"); + import std.base64; + auto str = Base64.encode(cast(ubyte[]) ("user=" ~ login.username ~ "\x01auth=Bearer " ~ login.oauthToken.strip ~ "\x01\x01")); + t = session.check!sendRequest(format!"AUTHENTICATE XOAUTH2 %s"(str)); res = session.check!responseGeneric(t); version (Trace) stderr.writefln("response: %s", res); rl = res.status;