public function OAuth::getOauth64

5.x OAuth.php public OAuth::getOauth64()

Generate a base64-encoded OAuth token.

Return value

string

File

inc/PHPMailer/src/OAuth.php, line 123

Class

OAuth
OAuth - OAuth2 authentication wrapper class. Uses the oauth2-client package from the League of Extraordinary Packages.

Namespace

PHPMailer\PHPMailer

Code

public function getOauth64() 
 {
  // Get a new token if it's not available or has expired
  if (null === $this->oauthToken or $this->oauthToken->hasExpired()) {
    $this->oauthToken = $this->getToken();
  }

  return base64_encode(
  'user=' .
    $this->oauthUserEmail .
    "\001auth=Bearer " .
    $this->oauthToken .
    "\001\001"
    );
}