BigW Consortium Gitlab

session.md 1.43 KB
Newer Older
1
# Session API
2

3 4 5 6
>**Deprecation notice:**
Starting in GitLab 8.11, this feature has been **disabled** for users with
[two-factor authentication][2fa] turned on. These users can access the API
using [personal access tokens] instead.
7

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

```
POST /session
```

15 16 17 18 19
| 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 |
20

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

25
Example response:
Dmitriy Zaporozhets committed
26

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

53 54
[2fa]: ../user/profile/account/two_factor_authentication.md
[personal access tokens]: ../user/profile/personal_access_tokens.md