HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/public/snappymail/snappymail/v/2.38.2/app/libraries/snappymail/sasl/xoauth2.php
<?php
/**
 * https://datatracker.ietf.org/doc/html/rfc7628
 * https://developers.google.com/gmail/imap/xoauth2-protocol
 */

namespace SnappyMail\SASL;

class XOAuth2 extends \SnappyMail\SASL
{
	public function authenticate(string $username,
		#[\SensitiveParameter]
		string $accessToken,
		?string $authzid = null
	) : string
	{
		return $this->encode("user={$username}\x01auth=Bearer {$accessToken}\x01\x01");
	}

	public static function isSupported(string $param) : bool
	{
		return true;
	}
}