Skip to content

Commit aa97014

Browse files
authored
Update README.md
1 parent 0a352c6 commit aa97014

File tree

1 file changed

+16
-30
lines changed

1 file changed

+16
-30
lines changed

README.md

+16-30
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,21 @@
22
PHP Google Authenticator Class. The easiest way to generate custom codes for google authenticator application with php.
33

44
### Usage:
5-
include authenticator.php
5+
include googleauth.php and base32.php
66
```php
7-
/*
8-
* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
9-
* [GOOGLE AUTH]
10-
* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
11-
*/
12-
include('authenticator.php');
13-
```
14-
you will create a password for the user or the domain you will use
15-
```php
16-
/* user code, username, user email etc. */
17-
$b32->fromString("area");
18-
```
19-
For the person or area you want to log in within the application.
20-
```php
21-
/*
22-
* Use this field to generate qr code
23-
* https://github.com/oxcakmak/PHP-QR-Code-Class
24-
*/
25-
echo gaCode($username, $user['gaSecretCode']);
26-
```
27-
To check the valid 30 second code generated within the application
28-
```php
29-
/*
30-
* These fields are written as examples.
31-
* In 2-step verification systems, you can store users' keys with jwt tokens as security.
32-
*/
33-
if(gaVerify($code, $user['gaSecretCode'])){
34-
/* Database, execute functions etc.*/
35-
}else{ /* if code false then */ }
7+
<?php
8+
include('base32.php');
9+
$b32 = new Base32;
10+
11+
include('googleauth.php');
12+
$ga = new GoogleAuth();
13+
14+
// How to generate key?
15+
$generatedKey = $b32->fromString($email);
16+
17+
// $str = [email protected] / $secret = user key
18+
$forApp = 'otpauth://totp/'.$str.'?secret='.$secret;
19+
20+
// Verify code
21+
$ga->checkCode($secret, $code) ? true : false;
3622
```

0 commit comments

Comments
 (0)