diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-22 06:08:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-22 06:08:39 +0300 |
commit | 65d7736ff13e1f5c393f6723b7da0d1b2ddb94f5 (patch) | |
tree | 2b56becb7f886bfece997c360b97ff37679c428f /doc | |
parent | 4d90876cc6b35bc418ccb6ea2536581289b272fb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/graphql/index.md | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/doc/api/graphql/index.md b/doc/api/graphql/index.md index 349b667f595..4f0811924aa 100644 --- a/doc/api/graphql/index.md +++ b/doc/api/graphql/index.md @@ -46,17 +46,19 @@ The [get started](getting_started.md) page includes different methods to customi ### Authentication -Some queries can be accessed anonymously without the request needing to be authenticated, -but others require it. Mutations always require authentication. +You can access some queries without authentication, but others require authentication. Mutations always require +authentication. -Authentication can happen by: +You can authenticate by using either a: - [Token](#token-authentication) - [Session cookie](#session-cookie-authentication) -If the authentication information is not valid, GitLab returns an error message with a status code of 401: +If the authentication information is not valid, GitLab returns an error message with a status code of `401`: +```json {"errors":[{"message":"Invalid token"}]} +``` #### Token authentication @@ -83,7 +85,7 @@ curl "https://gitlab.com/api/graphql" --header "Authorization: Bearer <token>" \ ##### Parameter authentication -Alternatively, OAuth 2.0 tokens can be passed in using the `access_token` parameter: +Example of using an OAuth 2.0 token in the `access_token` parameter: ```shell curl "https://gitlab.com/api/graphql?access_token=<oauth_token>" \ @@ -91,7 +93,7 @@ curl "https://gitlab.com/api/graphql?access_token=<oauth_token>" \ --data "{\"query\": \"query {currentUser {name}}\"}" ``` -Personal, project, or group access tokens can be passed in using the `private_token` parameter: +You can pass in personal, project, or group access tokens using the `private_token` parameter: ```shell curl "https://gitlab.com/api/graphql?private_token=<access_token>" \ |