我想在PHP中使用OAuth从交换帐户发送接收。目前我使用的是Phpmailer库但它需要密码,如何在没有密码的情况下实现它?从phpmailer使用gmail_xoauth.php库后,我收到了以下错误。
PHP Fatal error: Uncaught League\OAuth2\Client\Provider\Exception\IdentityProviderException: invalid_grant in C:\inetpub\wwwroot\bephpforTteam\GoogleOauthLogin\PHPMailer5\vendor\league\oauth2-google\src\Provider\Google.php:120
Stack trace:
#0 C:\inetpub\wwwroot\bephpforTteam\GoogleOauthLogin\PHPMailer5\vendor\league\oauth2-client\src\Provider\AbstractProvider.php(613): League\OAuth2\Client\Provider\Google->checkResponse(Object(GuzzleHttp\Psr7\Response), Array)
#1 C:\inetpub\wwwroot\bephpforTteam\GoogleOauthLogin\PHPMailer5\vendor\league\oauth2-client\src\Provider\AbstractProvider.php(528): League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse(Object(GuzzleHttp\Psr7\Request))
#2 C:\inetpub\wwwroot\bephpforTteam\GoogleOauthLogin\PHPMailer5\class.phpmaileroauthgoogle.php(69): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(Object(League\OAuth2\Client\Grant\RefreshToken), Array)
#3 C:\inetpub\wwwroot\bephpforTteam\GoogleOauthLogin\PHPMailer5\class.phpmaileroauthgoogle.php(74): PHPMailerOAuthGoogle->getT in C:\inetpub\wwwroot\bephpforTteam\GoogleOauthLogin\PHPMailer5\vendor\league\oauth2-google\src\Provider\Google.php on line 120