-
Notifications
You must be signed in to change notification settings - Fork 213
Open
Description
Issues Addressed:
- Added Issuer parameter to match the spec, separate from user
- Proper encoding to handle spaces in Issuer name
- made width and height optional parameters
Note: this may not be backward compatible given the way $domain was specified, but it does follow the Google spec located here........
https://github.com/google/google-authenticator/wiki/Key-Uri-Format
public function getUrl($issuer, $user, $secret, $width = 200, $height = 200) {
$url = sprintf("otpauth://totp/%s:%s?secret=%s&issuer=%s", rawurlencode($issuer), $user, $secret, rawurlencode($issuer));
$encoder = sprintf("https://www.google.com/chart?chs=%dx%d&chld=M|0&cht=qr&chl=",$width,$height);
$encoderURL = sprintf( "%s%s",$encoder, rawurlencode($url));
return $encoderURL;
}
Metadata
Metadata
Assignees
Labels
No labels