From e851bd071d2eca0d252e6f38ecb033c8c77ddb74 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 28 Jun 2020 22:33:48 +0100 Subject: [PATCH 1/2] Don't use deprecated auth in example --- doc/currentuser/repositories.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/currentuser/repositories.md b/doc/currentuser/repositories.md index fe1ec702e63..a3e2922b20f 100644 --- a/doc/currentuser/repositories.md +++ b/doc/currentuser/repositories.md @@ -25,6 +25,6 @@ There are three values that can be passed into the `repositories` method: `type` ```php $client = new \Github\Client(); -$client->authenticate($github_token, null, \Github\Client::AUTH_HTTP_TOKEN); +$client->authenticate($github_token, null, \Github\Client::AUTH_ACCESS_TOKEN); $client->currentUser()->repositories(); ``` From 5f1e6f7775c57dc0569a5966c07e8141422874a9 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 28 Jun 2020 22:35:50 +0100 Subject: [PATCH 2/2] Update security.md --- doc/security.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/security.md b/doc/security.md index 174300bb573..1ced88b97c2 100644 --- a/doc/security.md +++ b/doc/security.md @@ -51,11 +51,11 @@ Note however that GitHub describes this method as deprecated. In most case you s ### Authenticating as an Integration To authenticate as an integration you need to supply a JSON Web Token with `Github\Client::AUTH_JWT` to request -and installation access token which is then usable with `Github\Client::AUTH_HTTP_TOKEN`. [Github´s integration +and installation access token which is then usable with `Github\Client::AUTH_ACCESS_TOKEN`. [Github´s integration authentication docs](https://developer.github.com/apps/building-github-apps/authentication-options-for-github-apps/#authenticating-as-a-github-app) describe the flow in detail. It´s important for integration requests to use the custom Accept header `application/vnd.github.machine-man-preview`. -The following sample code authenticates as an installation using [lcobucci/jwt](https://github.com/lcobucci/jwt/tree/3.2.0) +The following sample code authenticates as an installation using [lcobucci/jwt](https://github.com/lcobucci/jwt/tree/3.3.2) to generate a JSON Web Token (JWT). ```php @@ -78,7 +78,7 @@ $jwt = (new Builder) $github->authenticate($jwt, null, Github\Client::AUTH_JWT); $token = $github->api('apps')->createInstallationToken($installationId); -$github->authenticate($token['token'], null, Github\Client::AUTH_HTTP_TOKEN); +$github->authenticate($token['token'], null, Github\Client::AUTH_ACCESS_TOKEN); ``` The `$integrationId` you can find in the about section of your github app.