public function GoogleAuthenticator::createURL in Google Authenticator login 7
Same name and namespace in other branches
- 6 ga4php.php \GoogleAuthenticator::createURL()
Create a url compatibile with google authenticator.
1 call to GoogleAuthenticator::createURL()
- GALoginGA::createURL in ./
ga_login.class.php - Create authentication URL.
1 method overrides GoogleAuthenticator::createURL()
- GALoginGA::createURL in ./
ga_login.class.php - Create authentication URL.
File
- ./
ga4php.php, line 282 - Abstract GoogleAuthenticator class.
Class
- GoogleAuthenticator
- @file Abstract GoogleAuthenticator class.
Code
public function createURL($user) {
// HOTP needs to be lowercase.
$data = $this
->internalGetData($user);
$toktype = $data["tokentype"];
$key = $this
->helperhex2b32($data["tokenkey"]);
// Token counter should be one more then current token value.
$counter = $data["tokencounter"] + 1;
$toktype = strtolower($toktype);
if ($toktype == "hotp") {
$url = "otpauth://{$toktype}/{$user}?secret={$key}&counter={$counter}";
}
else {
$url = "otpauth://{$toktype}/{$user}?secret={$key}";
}
return $url;
}