Authentication/Credentials

The authentication/credentials operation is an older mechanism for obtaining a session token required for invoking DocumentNOW V3 operations. Only AssureSign user credentials are supported.

New integration projects should use API Users via the method authentication/apiUserAuthentication.

Request

An authentication/credentials operation request will include the following information:

  • authRequest

  • username: an eSign username

  • password: the user's password

  • sessionLength: integer number of minutes being requested for the session to remain active

Sample Request:

Adjust the Host to match the location of your eSign account:

Copy
POST /api/documentnow/v3.0/authentication/credentials
Host: www.assuresign.net
Content-Type: application/json
Accept: application/json

{
    "request": {
        "authRequest": {
            "username": "robertuser@yourdomain.com",
            "password": "pass",
            "sessionLength": 1440
        }
    }
}

Response

If the request is successful, the operation will return a simple result that will include an sessionToken property. This sessionToken is used to construct an Authorization header in V3 methods. Set the Authorization header to X-AS-UserSessionToken plus the sessionToken returned from the operation. For example: Authorization: X-AS-UserSessionToken QWxhZGRpbjpvcGVuIHNlc2FtZQ==

Sample Response:

Copy
{
  "result": {
    "accounts": [
      {
        "accountId": "48b46d38-d9bf-4ddb-1278-f11122ffbf1c",
        "roleId": "6a85fe3d-a4ec-3bf9-92e1-7f8927f71a24",
        "name": "My Account Name",
        "isPrimary": true
      }
    ],
    "lastLoginDate": "2016-06-29T20:20:13.67",
    "sessionToken": "eyJ2YWxpZFVudGlsIjoxNDczMDEyOTg2MjI3LjE4MTIsImFjY291bnRJZCI6Ijg2YjY2ZDI4LWQ5Y2UtNGNkYi04MDA0LWYxNDc4NGRjYmYxYyIsImVtYWlsQWRkcmVzcyI6InJvYmVydHVzZXJAeW91cmRvbWFpbi5jb20iLCJmdWxsTmFtZSI6IlJvYmVydCBVc2VyIiwidXNlcklkIjoiYjB3YzRlMmQtY2Y0YS00NTEyLTllNzItYTFlZTAxMzcyMjhmIiwibmV2ZXJFeHBpcmUiOmZhbHNlLCJzaWduYXR1cmUiOiJrZ2VpZzViY2hFcVBZY1RuTmY3dm1NbGI0SHY3N2NjSHhOWjMzN2w3ZDRnIn0=",
    "tags": [],
    "user": {
      "userId": "b0wc4e2d-cf4a-4512-9e72-a1ee0137228f",
      "firstName": "Robert",
      "lastName": "User",
      "email": "robertuser@yourdomain.com",
      "active": true,
      "requirePasswordChange": false
    }
  }
}

If the credentials are incorrect, an authentication error will be returned.

Sample Authentication Error Response:

Copy
{
  "errorCode": "AUTHENTICATION_INVALID_CREDENTIALS",
  "summary": "Unable to authenticate user credentials.",
  "details": [
    "The specified username and password combination is incorrect."
  ]
}

If the request is formatted incorrectly or an error occurs during processing, an error response will be returned which will include an errorCode and a summary of the error.

Sample Error Response:

Copy
{
    "errorCode": "INTERNAL_SERVER_ERROR",
    "summary": "Unexpected end when deserializing object. Path 'request', line 9, position 1."
}