Skip to content

Create authentication attempt

/accounts/create_authentication_attempt

Target audience: Developers

Create authentication attempt

Introduction

This endpoint creates an authentication attempt connected to an account. The 25 latest authentication attempts can be viewed in the PAP. The authentication attempt is logged as coming from the application name of the API user associated with the access token used.

If 5 consecutive failed attempts are made within 1 hour the account will be frozen. An administrator must then unlock the account from PAP.

URI

Environment URI
Stage https://payway-api.stage.adeprimo.se/external/api/v1/accounts/create_authentication_attempt
Production https://backend.worldoftulo.com/external/api/v1/accounts/create_authentication_attempt

Requirements

Identity Scope
No /external/account/w

Parameters

Field Required Type Description
account_id Optional String The id of the account to archive.
Size range ..24
Allowed values: "/^[a-f\d]{24}$/i"
If not supplied the email parameter will be used
email Optional String The email of the account to get information about.
Size range: ..1024
Allowed
If not supplied the account_id parameter will be used
login_successful Required Boolean Was the login attempt succesful?
ip_address Optional String The IP address of the client attempting to log in. If this parameter is not supplied the remote address of the request will be used.
Size range: ..39
user_agent Required String The user agent of the client attempting to log in.
Size range: ..4096
persist Required Boolean Was the login attempt made with the flag for keeping the user logged in upon closing the client.

Curl Example

curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/accounts/create_authentication_attempt \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token' \
  --header 'content-type: application/json' \
  --data '{
            "account_id": "test@example.com",
            "login_successful": true,
            "ip_address": "127.0.0.1",
            "user_agent": "My own application, v. 1.0",
            "persist": false,
          }'

Response

Field Description
id The id of the created login attempt.
successful Was the login attempt succesful?
created Timestamp for creation.
ip_address The IP address of the client attempting to log in.
user_agent The user agent of the client attempting to log in.
persist Was the login attempt made using the flag for keeping user logged in upon closing the client.
application The application name assigned to the API user associated with the access token used for this api call.

Response

HTTP 201 Created
{
  "id": "5caf3c206e95528fe2943abe",
  "successful": true,
  "created": "Thu, 11 Apr 2019 15:07:44 +0200",
  "ip_address": "128.0.0.1",
  "user_agent": "bogus",
  "persist": false,
  "application": "My own application, v. 1.0",
}

Errors

Example error response

HTTP 400 Bad request
{
  "code": "unknown_parameter",
  "message": "Unknown parameters: my_parameter",
}

HTTP 400 Bad Request

Name Type Description
invalid_parameter Object Validation error on any of the fields in the posted json
json_parser_error Object The request body could not be parsed as valid json
invalid_content_type_error Object The requests Content-Type header isn't set to application/json
unknown_parameter Object One or more of the fields in the posted json was not recognized

HTTP 404 Not Found

Name Type Description
does_not_exist Object The account does not exist

HTTP 500 Internal Server Error

Name Type Description
internal_server_error Object Something unexpected happened server side