Skip to content

Commit 21feb10

Browse files
committed
Adding GitHub authentication to GraphQL documentation
1 parent 25f9206 commit 21feb10

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

doc/graphql.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ Wraps [GitHub v4 API (GraphQL API)](http://developer.github.com/v4/).
99
$rateLimits = $client->api('graphql')->execute($query);
1010
```
1111

12+
#### Authentication
13+
14+
To use [GitHub v4 API (GraphQL API)](http://developer.github.com/v4/) requests must [authenticated]((../security.md)).
15+
16+
```php
17+
$client->authenticate($token, null, Github\Client::AUTH_ACCESS_TOKEN);
18+
19+
$result = $client->api('graphql')->execute($query);
20+
```
21+
1222
#### Use variables
1323

1424
[Variables](https://developer.github.com/v4/guides/forming-calls/#working-with-variables) allow specifying of requested data without dynamical change of a query on a client side.
@@ -28,5 +38,7 @@ $variables = [
2838
'organizationLogin' => 'KnpLabs'
2939
];
3040

41+
$client->authenticate('<your-token>', null, Github\Client::AUTH_ACCESS_TOKEN);
42+
3143
$orgInfo = $client->api('graphql')->execute($query, $variables);
32-
```
44+
```

0 commit comments

Comments
 (0)