Authenticate a user

POST /api/2.0/authentication

Request

Authenticates the current user by SMS, authenticator app, or without two-factor authentication.

Headers

Acceptenum of string

Can be one of: application/json, text/json, text/plain.

Content-Typeenum of string

Can be one of: application/json, application/*+json, text/json.

Body

Authentication request parameters

userNamestring

Username / email

passwordstring

Password

passwordHashstring

Password hash

providerstring

Provider type

accessTokenstring

Provider access token

serializedProfilestring

Serialized user profile

codestring

Two-factor authentication code

codeOAuthstring

Code for getting a token

sessionboolean

Session based authentication or not

confirmDataobject
emailstringformat: email

Email address

firstboolean

Access an account for the first time or not

keystring

Key

recaptchaTypeone of
.enum of string

[Default - Default, AndroidV2 - AndroidV2, iOSV2 - iOSV2, hCaptcha - hCaptcha]

Can be one of: Default, AndroidV2, iOSV2, hCaptcha.

.enum of integer

[0 - Default, 1 - AndroidV2, 2 - iOSV2, 3 - hCaptcha]

Can be one of: 0, 1, 2, 3.

recaptchaResponsestring

reCAPTCHA response

culturestring

Culture

Examples

POST /api/2.0/authentication HTTP/1.1
Accept: application/json
Content-Length: 423
Content-Type: application/json
Host: example.com

{
  "userName": "some text",
  "password": "044LP3vr2j",
  "passwordHash": "some text",
  "provider": "some text",
  "accessToken": "some text",
  "serializedProfile": "some text",
  "code": "some text",
  "codeOAuth": "some text",
  "session": true,
  "confirmData": {
    "email": "Amanda.Ernser94@hotmail.com",
    "first": true,
    "key": "some text"
  },
  "recaptchaResponse": "some text",
  "culture": "some text"
}
curl --request POST \
  --url https://example.com/api/2.0/authentication \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "userName": "some text",
  "password": "044LP3vr2j",
  "passwordHash": "some text",
  "provider": "some text",
  "accessToken": "some text",
  "serializedProfile": "some text",
  "code": "some text",
  "codeOAuth": "some text",
  "session": true,
  "confirmData": {
    "email": "Amanda.Ernser94@hotmail.com",
    "first": true,
    "key": "some text"
  },
  "recaptchaResponse": "some text",
  "culture": "some text"
}'

Responses

200

Authentication data

tokenstring

Authentication token

expiresstringformat: date-time

Token expiration time

smsboolean

Specifies if the authentication code is sent by SMS or not

phoneNoisestring

Phone number

tfaboolean

Specifies if the two-factor application is used or not

tfaKeystring

Two-factor authentication key

confirmUrlstringformat: uri

Confirmation email URL

400

userName, password or passworHash is empty

401

User authentication failed

404

The user could not be found

429

Too many login attempts. Please try again later

Get Help

  • If you have any questions about ONLYOFFICE DocSpace, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).