doc-locale/fr-fr/api/user_applications.md
{{< details >}}
{{< /details >}}
Utilisez cette API pour gérer les applications OAuth au niveau utilisateur qui :
[!note] Pour gérer les applications à l'échelle de l'instance, utilisez l'API Applications.
Prérequis :
Crée une nouvelle application OAuth pour l'utilisateur authentifié.
Renvoie 201 si la requête aboutit.
POST /user/applications
Attributs pris en charge :
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
name | string | oui | Nom de l'application. |
redirect_uri | string | oui | URI de redirection de l'application. |
scopes | string | oui | Portées disponibles pour l'application. Séparez plusieurs portées par un espace. |
confidential | boolean | non | Si true, l'application peut stocker en toute sécurité les informations d'identification du client, telles que le secret client. Les applications non confidentielles (telles que les applications mobiles natives et les applications monopages) peuvent exposer les informations d'identification du client. Si non spécifié, la valeur par défaut est true. |
Exemple de requête :
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--data "name=MyApplication&redirect_uri=http://redirect.uri&scopes=api read_user email" \
--url "https://gitlab.example.com/api/v4/user/applications"
Exemple de réponse :
{
"id":1,
"application_id": "5832fc6e14300a0d962240a8144466eef4ee93ef0d218477e55f11cf12fc3737",
"application_name": "MyApplication",
"secret": "ee1dd64b6adc89cf7e2c23099301ccc2c61b441064e9324d963c46902a85ec34",
"callback_url": "http://redirect.uri",
"confidential": true
}
Liste toutes les applications appartenant à l'utilisateur authentifié.
GET /user/applications
Exemple de requête :
curl --request GET \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/user/applications"
Exemple de réponse :
[
{
"id":1,
"application_id": "5832fc6e14300a0d962240a8144466eef4ee93ef0d218477e55f11cf12fc3737",
"application_name": "MyApplication",
"callback_url": "http://redirect.uri",
"confidential": true
}
]
Récupère les détails d'une application spécifique appartenant à l'utilisateur authentifié.
Renvoie 200 si la requête aboutit.
GET /user/applications/:id
Attributs pris en charge :
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | integer | oui | ID de l'application. Diffère du application_id. |
Exemple de requête :
curl --request GET \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/user/applications/:id"
Exemple de réponse :
{
"id":1,
"application_id": "5832fc6e14300a0d962240a8144466eef4ee93ef0d218477e55f11cf12fc3737",
"application_name": "MyApplication",
"callback_url": "http://redirect.uri",
"confidential": true
}
Met à jour une application existante appartenant à l'utilisateur authentifié.
Renvoie 200 si la requête aboutit.
PUT /user/applications/:id
Attributs pris en charge :
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | integer | oui | ID de l'application. Diffère du application_id. |
name | string | non | Nom de l'application. |
scopes | string | non | Portées disponibles pour l'application. Séparez plusieurs portées par un espace. |
Exemple de requête :
curl --request PUT \
--header "PRIVATE-TOKEN: <your_access_token>" \
--data "name=UpdatedApplication" \
--url "https://gitlab.example.com/api/v4/user/applications/:id"
Exemple de réponse :
{
"id":1,
"application_id": "5832fc6e14300a0d962240a8144466eef4ee93ef0d218477e55f11cf12fc3737",
"application_name": "UpdatedApplication",
"callback_url": "http://redirect.uri",
"confidential": true
}
Supprime une application spécifiée appartenant à l'utilisateur authentifié.
Renvoie 204 si la requête aboutit.
DELETE /user/applications/:id
Attributs pris en charge :
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | integer | oui | ID de l'application. Diffère du application_id. |
Exemple de requête :
curl --request DELETE \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/user/applications/:id"