Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticator::getQRContent PHP Method

getQRContent() public method

Generate the content for a QR-Code to be scanned by Google Authenticator Use this method if you don't want to use google charts to display the qr-code
public getQRContent ( Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface $user ) : string
$user Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface
return string
    public function getQRContent(TwoFactorInterface $user)
    {
        $userAndHost = rawurlencode($user->getUsername()) . ($this->server ? '@' . rawurlencode($this->server) : '');
        if ($this->issuer) {
            $qrContent = sprintf('otpauth://totp/%s:%s?secret=%s&issuer=%s', rawurlencode($this->issuer), $userAndHost, $user->getGoogleAuthenticatorSecret(), rawurlencode($this->issuer));
        } else {
            $qrContent = sprintf('otpauth://totp/%s?secret=%s', $userAndHost, $user->getGoogleAuthenticatorSecret());
        }
        return $qrContent;
    }