2017-05-18 04:49:03 -04:00
|
|
|
# Session API
|
2014-05-27 08:12:15 -04:00
|
|
|
|
2016-06-21 01:33:50 -04:00
|
|
|
## Deprecation Notice
|
|
|
|
|
2016-08-15 18:14:22 -04:00
|
|
|
1. Starting in GitLab 8.11, this feature has been *disabled* for users with two-factor authentication turned on.
|
2016-06-21 01:33:50 -04:00
|
|
|
2. These users can access the API using [personal access tokens] instead.
|
|
|
|
|
|
|
|
---
|
|
|
|
|
2016-01-18 03:43:46 -05:00
|
|
|
You can login with both GitLab and LDAP credentials in order to obtain the
|
|
|
|
private token.
|
2012-09-20 10:44:44 -04:00
|
|
|
|
|
|
|
```
|
|
|
|
POST /session
|
|
|
|
```
|
|
|
|
|
2016-01-18 03:43:46 -05:00
|
|
|
| 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 |
|
2012-09-20 10:44:44 -04:00
|
|
|
|
2016-01-18 03:43:46 -05:00
|
|
|
```bash
|
2017-03-01 12:39:40 -05:00
|
|
|
curl --request POST "https://gitlab.example.com/api/v4/session?login=john_smith&password=strongpassw0rd"
|
2016-01-18 03:43:46 -05:00
|
|
|
```
|
2012-09-20 10:44:44 -04:00
|
|
|
|
2016-01-18 03:43:46 -05:00
|
|
|
Example response:
|
2013-07-16 04:50:00 -04:00
|
|
|
|
2012-09-20 10:44:44 -04:00
|
|
|
```json
|
|
|
|
{
|
|
|
|
"name": "John Smith",
|
2016-01-18 03:43:46 -05:00
|
|
|
"username": "john_smith",
|
|
|
|
"id": 32,
|
|
|
|
"state": "active",
|
|
|
|
"avatar_url": null,
|
|
|
|
"created_at": "2015-01-29T21:07:19.440Z",
|
|
|
|
"is_admin": true,
|
2013-03-18 17:06:24 -04:00
|
|
|
"bio": null,
|
|
|
|
"skype": "",
|
|
|
|
"linkedin": "",
|
|
|
|
"twitter": "",
|
2014-01-18 14:07:00 -05:00
|
|
|
"website_url": "",
|
2016-01-18 03:43:46 -05:00
|
|
|
"email": "john@example.com",
|
|
|
|
"color_scheme_id": 1,
|
|
|
|
"projects_limit": 10,
|
|
|
|
"current_sign_in_at": "2015-07-07T07:10:58.392Z",
|
|
|
|
"identities": [],
|
2014-04-05 02:36:47 -04:00
|
|
|
"can_create_group": true,
|
2016-01-18 03:43:46 -05:00
|
|
|
"can_create_project": true,
|
|
|
|
"two_factor_enabled": false,
|
|
|
|
"private_token": "9koXpg98eAheJpvBs5tK"
|
2012-09-20 10:44:44 -04:00
|
|
|
}
|
|
|
|
```
|
2016-06-21 01:33:50 -04:00
|
|
|
|
|
|
|
[personal access tokens]: ./README.md#personal-access-tokens
|