mirror of
https://github.com/RobThree/TwoFactorAuth.git
synced 2026-08-25 17:36:35 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ecee1426cf | |||
| 515f3a9bb8 |
@@ -21,20 +21,17 @@ Example code:
|
|||||||
|
|
||||||
```php
|
```php
|
||||||
use RobThree\Auth\TwoFactorAuth;
|
use RobThree\Auth\TwoFactorAuth;
|
||||||
use RobThree\Auth\Providers\Qr\QRServerProvider; // if using library's provider
|
|
||||||
use RobThree\Auth\Providers\Qr\BaconQrCodeProvider; // if using Bacon
|
use RobThree\Auth\Providers\Qr\BaconQrCodeProvider; // if using Bacon
|
||||||
use RobThree\Auth\Providers\Qr\EndroidQrCodeProvider; // if using Endroid
|
use RobThree\Auth\Providers\Qr\EndroidQrCodeProvider; // if using Endroid
|
||||||
|
|
||||||
// using the default Qr Code provider from the library
|
|
||||||
$tfa = new TwoFactorAuth(new QRServerProvider(), "Your app name");
|
|
||||||
// using Bacon
|
// using Bacon
|
||||||
$tfa = new TwoFactorAuth(new BaconQrCodeProvider(), "Your app name");
|
$tfa = new TwoFactorAuth(new BaconQrCodeProvider());
|
||||||
// using Endroid
|
// using Endroid
|
||||||
$tfa = new TwoFactorAuth(new EndroidQrCodeProvider(), "Your app name");
|
$tfa = new TwoFactorAuth(new EndroidQrCodeProvider());
|
||||||
// using a custom object implementing IQRCodeProvider interface
|
// using a custom object implementing IQRCodeProvider interface
|
||||||
$tfa = new TwoFactorAuth(new MyQrCodeProvider(), "Your app name");
|
$tfa = new TwoFactorAuth(new MyQrCodeProvider());
|
||||||
// using named argument and a variable
|
// using named argument and a variable
|
||||||
$tfa = new TwoFactorAuth(qrcodeprovider: $qrGenerator, issuer: "Your app name");
|
$tfa = new TwoFactorAuth(qrcodeprovider: $qrGenerator);
|
||||||
```
|
```
|
||||||
|
|
||||||
## 3. Shared secrets
|
## 3. Shared secrets
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ abstract class BaseHTTPQRCodeProvider implements IQRCodeProvider
|
|||||||
throw new QRException(curl_error($curlhandle));
|
throw new QRException(curl_error($curlhandle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
curl_close($curlhandle);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user