debian-mirror-gitlab/doc/api/session.md

56 lines
1.4 KiB
Markdown
Raw Normal View History

2014-09-02 18:07:02 +05:30
# Session
2016-08-24 12:49:21 +05:30
## Deprecation Notice
2016-09-13 17:45:13 +05:30
1. Starting in GitLab 8.11, this feature has been *disabled* for users with two-factor authentication turned on.
2016-08-24 12:49:21 +05:30
2. These users can access the API using [personal access tokens] instead.
---
2016-04-02 18:10:28 +05:30
You can login with both GitLab and LDAP credentials in order to obtain the
private token.
2014-09-02 18:07:02 +05:30
```
POST /session
```
2016-04-02 18:10:28 +05:30
| Attribute | Type | Required | Description |
| ---------- | ------- | -------- | -------- |
| `login` | string | yes | The username of the user|
| `email` | string | yes if login is not provided | The email of the user |
| `password` | string | yes | The password of the user |
2014-09-02 18:07:02 +05:30
2016-04-02 18:10:28 +05:30
```bash
2017-08-17 22:00:37 +05:30
curl --request POST "https://gitlab.example.com/api/v4/session?login=john_smith&password=strongpassw0rd"
2016-04-02 18:10:28 +05:30
```
2014-09-02 18:07:02 +05:30
2016-04-02 18:10:28 +05:30
Example response:
2014-09-02 18:07:02 +05:30
```json
{
"name": "John Smith",
2016-04-02 18:10:28 +05:30
"username": "john_smith",
"id": 32,
"state": "active",
"avatar_url": null,
"created_at": "2015-01-29T21:07:19.440Z",
"is_admin": true,
2014-09-02 18:07:02 +05:30
"bio": null,
"skype": "",
"linkedin": "",
"twitter": "",
"website_url": "",
2016-04-02 18:10:28 +05:30
"email": "john@example.com",
"color_scheme_id": 1,
"projects_limit": 10,
"current_sign_in_at": "2015-07-07T07:10:58.392Z",
"identities": [],
2014-09-02 18:07:02 +05:30
"can_create_group": true,
2016-04-02 18:10:28 +05:30
"can_create_project": true,
"two_factor_enabled": false,
"private_token": "9koXpg98eAheJpvBs5tK"
2014-09-02 18:07:02 +05:30
}
```
2016-08-24 12:49:21 +05:30
[personal access tokens]: ./README.md#personal-access-tokens