Skip to content

Commit

Permalink
need to encode username in the passed token too
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdruppe committed Nov 30, 2023
1 parent 11351ec commit 1e4ec6c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions source/symmetry/imap/request.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1e4ec6c

Please sign in to comment.