Skip to content

Don't use deprecated auth in examples #892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/currentuser/repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
```
6 changes: 3 additions & 3 deletions doc/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down