Skip to content

Commit e94ce3d

Browse files
authored
Merge pull request #528 from acrobat/integration-authentication-doc-fix
Fixed integration authentication example
2 parents 2d22344 + 6cb20db commit e94ce3d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

doc/security.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,18 @@ The following sample code authenticates as an installation using [lcobucci/jwt](
5454
to generate a JSON Web Token (JWT).
5555

5656
```php
57+
use Lcobucci\JWT\Builder;
58+
use Lcobucci\JWT\Signer\Key;
59+
use Lcobucci\JWT\Signer\Rsa\Sha256;
60+
5761
$builder = new Github\HttpClient\Builder(new GuzzleClient());
5862
$github = new Github\Client($builder, 'machine-man-preview');
5963

6064
$jwt = (new Builder)
6165
->setIssuer($integrationId)
6266
->setIssuedAt(time())
6367
->setExpiration(time() + 60)
64-
->sign(new Sha256(), (new Keychain)->getPrivateKey($pemPrivateKeyPath))
68+
->sign(new Sha256(), new Key('file:///path/to/integration.private-key.pem'))
6569
->getToken();
6670

6771
$github->authenticate($jwt, null, Github\Client::AUTH_JWT);

0 commit comments

Comments
 (0)