PHPMailer\PHPMailer

OAuth::getOauth64publicWP 1.0

Generate a base64-encoded OAuth token.

Method of the class: OAuth{}

No Hooks.

Returns

String.

Usage

$OAuth = new OAuth();
$OAuth->getOauth64();

OAuth::getOauth64() code WP 6.9

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

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