Chr(1) updated, but I'm still getting the same error
//VB code
Dim pattern As String = String.Format("user={0}{1}auth=Bearer {2}{1}{1}", "imapuser01@krungsri365.onmicrosoft.com", Chr(1), dict("access_token"))
token = Convert.ToBase64String(Encoding.ASCII.GetBytes(pattern))
//log
2022-08-22 15:09:02.923 Opening log file.
2022-08-22 15:09:02.926 INFO FileLogWriter(1)[1] Info: Assembly: Rebex.Common R6.5 for .NET 4.6-4.8
2022-08-22 15:09:02.929 INFO FileLogWriter(1)[1] Info: Platform: Windows 6.2.9200 32-bit; CLR: 4.0.30319.42000
2022-08-22 15:09:02.929 DEBUG FileLogWriter(1)[1] Info: Culture: en; windows-874
2022-08-22 15:09:07.872 DEBUG Imap(1)[1] Info: State changed from 'Disconnected' to 'Connecting'.
2022-08-22 15:09:07.872 INFO Imap(1)[1] Info: Connecting to Outlook.office365.com:993 using Imap.
2022-08-22 15:09:07.873 INFO Imap(1)[1] Info: Assembly: Rebex.Imap R6.5 for .NET 4.6-4.8 (Trial)
2022-08-22 15:09:07.873 INFO Imap(1)[1] Info: Platform: Windows 6.2.9200 32-bit; CLR: 4.0.30319.42000
2022-08-22 15:09:07.873 DEBUG Imap(1)[1] Info: Culture: en; windows-874
2022-08-22 15:09:07.884 INFO Imap(1)[1] Info: Connecting to 40.100.18.2.
2022-08-22 15:09:07.896 DEBUG Imap(1)[1] Proxy: Connecting to 40.100.18.2:993 (no proxy).
2022-08-22 15:09:07.925 DEBUG Imap(1)[1] Proxy: Connection established.
2022-08-22 15:09:07.925 DEBUG Imap(1)[1] Info: Connection succeeded.
2022-08-22 15:09:07.930 DEBUG Imap(1)[1] Info: Upgrading connection to TLS.
2022-08-22 15:09:07.994 DEBUG Imap(1)[1] TLS: Using classic TLS core.
2022-08-22 15:09:08.014 DEBUG Imap(1)[1] TLS: Enabled cipher suites: 0x0C1FFFFFFFF4F666.
2022-08-22 15:09:08.089 DEBUG Imap(1)[1] TLS: Applicable cipher suites: 0x0C1FFFFFFFF4F666.
2022-08-22 15:09:08.098 DEBUG Imap(1)[1] TLS: HandshakeMessage:ClientHello was sent.
2022-08-22 15:09:08.139 DEBUG Imap(1)[1] TLS: HandshakeMessage:ServerHello was received.
2022-08-22 15:09:08.140 INFO Imap(1)[1] TLS: Negotiating TLS 1.2, RSA with ephemeral ECDH, AES with 256-bit key in GCM mode, AEAD.
2022-08-22 15:09:08.142 DEBUG Imap(1)[1] TLS: The server supports secure renegotiation.
2022-08-22 15:09:08.143 DEBUG Imap(1)[1] TLS: Extended master secret is enabled.
2022-08-22 15:09:08.144 DEBUG Imap(1)[1] TLS: HandshakeMessage:Certificate was received.
2022-08-22 15:09:08.157 DEBUG Imap(1)[1] TLS: HandshakeMessage:ServerKeyExchange was received.
2022-08-22 15:09:08.157 DEBUG Imap(1)[1] TLS: HandshakeMessage:ServerHelloDone was received.
2022-08-22 15:09:08.160 DEBUG Imap(1)[1] TLS: Verifying server certificate ('CN=outlook.com, O=Microsoft Corporation, L=Redmond, S=Washington, C=US').
2022-08-22 15:09:08.161 DEBUG Imap(1)[1] TLS: Certificate verification result: Accept
2022-08-22 15:09:08.162 DEBUG Imap(1)[1] TLS: Verifying server key exchange signature.
2022-08-22 15:09:08.185 DEBUG Imap(1)[1] TLS: Using ephemeral ECDH public key exchange with NIST P-384 curve.
2022-08-22 15:09:08.195 DEBUG Imap(1)[1] TLS: HandshakeMessage:ClientKeyExchange was sent.
2022-08-22 15:09:08.209 DEBUG Imap(1)[1] TLS: CipherSpec:ChangeCipherSpec was sent.
2022-08-22 15:09:08.210 DEBUG Imap(1)[1] TLS: HandshakeMessage:Finished was sent.
2022-08-22 15:09:08.242 DEBUG Imap(1)[1] TLS: CipherSpec:ChangeCipherSpec was received.
2022-08-22 15:09:08.245 DEBUG Imap(1)[1] TLS: HandshakeMessage:Finished was received.
2022-08-22 15:09:08.245 INFO Imap(1)[1] TLS: Connection secured using cipher: TLS 1.2, RSA with ephemeral ECDH, AES with 256-bit key in GCM mode, AEAD.
2022-08-22 15:09:08.246 DEBUG Imap(1)[1] Info: Connection upgraded to TLS 1.2.
2022-08-22 15:09:08.324 DEBUG Imap(1)[1] Info: State changed from 'Connecting' to 'Reading'.
2022-08-22 15:09:08.328 INFO Imap(1)[1] Response: * OK The Microsoft Exchange IMAP4 service is ready. [SwBVADEAUABSADAAMwBDAEEAMAAwADAANAAuAGEAcABjAHAAcgBkADAAMwAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A]
2022-08-22 15:09:08.348 DEBUG Imap(1)[1] Info: State changed from 'Reading' to 'Ready'.
2022-08-22 15:09:08.355 DEBUG Imap(1)[1] Info: State changed from 'Ready' to 'Sending'.
2022-08-22 15:09:08.357 INFO Imap(1)[1] Command: R00001 CAPABILITY
2022-08-22 15:09:08.357 DEBUG Imap(1)[1] Info: State changed from 'Sending' to 'Reading'.
2022-08-22 15:09:08.384 INFO Imap(1)[1] Response: * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
2022-08-22 15:09:08.384 INFO Imap(1)[1] Response: R00001 OK CAPABILITY completed.
2022-08-22 15:09:08.384 DEBUG Imap(1)[1] Info: State changed from 'Reading' to 'Ready'.
2022-08-22 15:09:08.401 DEBUG Imap(1)[1] Info: State changed from 'Ready' to 'Sending'.
2022-08-22 15:09:08.401 INFO Imap(1)[1] Command: R00002 AUTHENTICATE XOAUTH2 dXNlcj1pbWFwdXNlcjAxQGtydW5nc3JpMzY1Lm9ubWljcm9zb2Z0LmNvbQFhdXRoPUJlYXJlciBleUowZVhBaU9pSktWMVFpTENKdWIyNWpaU0k2SWsxNWVYZFNVbmwyU0cwd1prNUJia3MwV0VJMmFuRXpSVXMxTXpSclIxWlFaRzFMTm5sd2VucFZMVkVpTENKaGJHY2lPaUpTVXpJMU5pSXNJbmcxZENJNklqSmFVWEJLTTFWd1ltcEJXVmhaUjJGWVJVcHNPR3hXTUZSUF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TENKMGFXUWlPaUkwWXpBNE5EVTBaUzFqTW1Zd0xUUXlNamN0WWpWbE5TMWtZVEpoT0dZek5qSmpPRElpTENKMWRHa2lPaUpwWTE5MVYyMXZUVGhWVTNsaFIwZHdRWFk0VDBGQklpd2lkbVZ5SWpvaU1TNHdJaXdpZDJsa2N5STZXeUl3T1RrM1lURmtNQzB3WkRGa0xUUmhZMkl0WWpRd09DMWtOV05oTnpNeE1qRmxPVEFpWFN3aWVHMXpYM1JqWkhRaU9qRTFNVGt6TlRjd01ETjkuSjVNWE1jUWhpZVlyNGRDWXRpaEhJdWpzTWlRMC1YRl8wMFlac3JMNWF6UFFDX0hFZ1RCeUZQZFlsU0hqa0pNcDE0QlJUdnp1YklCbTc5ekktY253VGEwc2tJaGpCdDYyQWtXQ2V2NmItT21KTkRzakkxM2Njd0NRT1M4Z20wR2dFeTh0US1naFhiZk9jd0h5QVlOXzNRcC1wQ1lsYjdJaHQ4RjM0azByY0JURnVXWFpBQmpZRlA0OVo1RGRPOFJlRk5JRGxyS1NMaTdkNEE2ZDhycjg2eWZ6YU1vUGRjd0c1UjdSSXdRd3ZkV2dXZ01Kb2FhOXR1aHFhOFNvQk5qTlJYSlBGUXRFanFjaXlxaTRjaW11ci1HZUZyQnBMVW41Mjd5UDBPc2VMTmNfQmo3enR6MWM3UXB4RWN6MDhMdVJQMGRKREVCVnVIUW4xWGVUSFNIcUpnAQE=
2022-08-22 15:09:08.401 DEBUG Imap(1)[1] Info: State changed from 'Sending' to 'Reading'.
2022-08-22 15:09:11.315 INFO Imap(1)[1] Response: R00002 NO AUTHENTICATE failed.
2022-08-22 15:09:11.315 DEBUG Imap(1)[1] Info: State changed from 'Reading' to 'Ready'.
2022-08-22 15:09:11.338 ERROR Imap(1)[1] Info: Rebex.Net.ImapException: AUTHENTICATE failed (NO).
at Rebex.Net.Imap.ftvcl(String p0, ImapResponse p1, Boolean p2)
at Rebex.Net.Imap.nbxxz(String p0)
at Rebex.Net.Imap.alsfl(String p0, String p1, ImapAuthentication p2, GssApiProvider p3)
at Rebex.Net.Imap.ccovk(String p0, String p1, ImapAuthentication p2)