Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 526 Bytes

two_factor_authentication.md

File metadata and controls

19 lines (14 loc) · 526 Bytes

Two factor authentication

Back to the navigation

Raising the exception

try {
    $authorization = $github->api('authorizations')->create();
} catch (Github\Exception\TwoFactorAuthenticationRequiredException $e) {
    echo sprintf("Two factor authentication of type %s is required.", $e->getType());
}

Once the code has been retrieved (by sms for example), you can create an authorization:

$authorization = $github->api('authorizations')->create(array('note' => 'Optional'), $code);