session.md 1.38 KB
Newer Older
Marin Jankovski's avatar
Marin Jankovski committed
1 2
# Session

3 4
## Deprecation Notice

5
1. Starting in GitLab 8.11, this feature has been *disabled* for users with two-factor authentication turned on.
6 7 8 9
2. These users can access the API using [personal access tokens] instead.

---

10 11
You can login with both GitLab and LDAP credentials in order to obtain the
private token.
12 13 14 15 16

```
POST /session
```

17 18 19 20 21
| 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 |
22

23
```bash
24
curl --request POST "https://gitlab.example.com/api/v3/session?login=john_smith&password=strongpassw0rd"
25
```
26

27
Example response:
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
28

29 30 31
```json
{
  "name": "John Smith",
32 33 34 35 36 37
  "username": "john_smith",
  "id": 32,
  "state": "active",
  "avatar_url": null,
  "created_at": "2015-01-29T21:07:19.440Z",
  "is_admin": true,
Alex Denisov's avatar
Alex Denisov committed
38 39 40 41
  "bio": null,
  "skype": "",
  "linkedin": "",
  "twitter": "",
Jerome Dalbert's avatar
Jerome Dalbert committed
42
  "website_url": "",
43
  "email": "john@example.com",
44
  "theme_id": 1,
45 46 47 48
  "color_scheme_id": 1,
  "projects_limit": 10,
  "current_sign_in_at": "2015-07-07T07:10:58.392Z",
  "identities": [],
Johannes Schleifenbaum's avatar
Johannes Schleifenbaum committed
49
  "can_create_group": true,
50 51 52
  "can_create_project": true,
  "two_factor_enabled": false,
  "private_token": "9koXpg98eAheJpvBs5tK"
53 54
}
```
55 56

[personal access tokens]: ./README.md#personal-access-tokens