Login Log

Login Logs is a simple API to record a login event (e.g. successful login) and retrieve a list of events.

Create

Create a login log:

POST /v1/login_logs
nametypereqdesc
user_idstring [1..100]

The user_id parameter is a string, from 1 to 100 characters, which is used to identify the user. In most cases, this would by the id of your user. From Authen's point of view, it is an opaque value.

statusint

An integer which maps to your login events. For example, 1 could be successful, 2 could mean invalid password, 3 could mean invalid TOTP code, etc.

payloadany

Arbitrary data to associate with the login log. This data will be returned when listing the login logs. This can be omitted/null.

nametypedesc
iduuid

The id of the created log.

curl -X POST "http://127.0.0.1:5200/v1/login_logs" \
	-H "Content-Type: application/json" \
	-d '{
	"user_id": "d65d8f1a-4380-45e0-bfd3-819ddb4504df",
	"status": 1,
	"payload": {"from": "reset_passwrod"}
}'
{"id":"4cf3670b-0d3b-4d98-b0d4-ac4ff42f445a"}
codedesc
102012

The project has reached the maximum configured login logs.

102013

The payload is larger than the maximum configured length.

The general error section details Authen's error responses as well as detailing all errors, including global errors, such as validation and internal server errors.

List

Returns the login logs for a user.

GET /v1/login_logs
nametypereqdesc
user_idstring [1..100]

The user_id parameter is a string, from 1 to 100 characters, which is used to identify the user. In most cases, this would by the id of your user. From Authen's point of view, it is an opaque value.

pageint[1..]

Fetch the specified page. Defaults to 1.

perpageint[1..]

Fetch the specified number of records per page. Defaults to 100.

nametypedesc
iduuid

The id of the login log.

statusint

The status associated with the login log when it was created.

createddatetime

RFC 3339 time that login log was created.

payloadany

The data, if any, associated with the login log when it was created.

curl "http://127.0.0.1:5200/v1/login_logs?"\
  "user_id=d65d8f1a-4380-45e0-bfd3-819ddb4504df"\
  "&perpage=10&page=1"
{
  "results":
  [
    {
      "id": "4cf3670b-0d3b-4d98-b0d4-ac4ff42f445a",
      "status": 1,
      "payload":{"from": "reset_passwrod"},
      "created": "2022-11-08T09:52:50.366285+00:00"
    }
  ]
}

The general error section details Authen's error responses as well as detailing all errors, including global errors, such as validation and internal server errors.