Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

be able to assign a "name" to the listing in the authenticator app. #11

Open
stoneobscurity opened this issue Nov 10, 2013 · 1 comment

Comments

@stoneobscurity
Copy link

after scanning my barcode with the authenticator app, there is no header or title or name or whatever you want to call it, so that i can tell one OTP code in my list from another.

@stoneobscurity
Copy link
Author

ok, i managed to figure it out. you need to add the ISSUER to the URL call.

public function getUrl($user, $hostname, $secret, $issuer) {

    $url =  sprintf("otpauth://totp/%s@%s?secret=%s", $user, $hostname, $secret, $label);
    $encoder = "https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl=";
    $encoderURL = $encoder . urlencode( sprintf( "otpauth://totp/%s@%s?secret=%s&issuer=%s", $user, $hostname, $secret, $issuer) );

    return $encoderURL;

}

and be sure to adjust the page where you display the QR code

$issuer = urlencode("Some Name Here");
$g = new GoogleAuthenticator();
$link = $g->getUrl($user->getUsername(),$_SERVER['HTTP_HOST'],$secret,$issuer);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant