17.2.2.14.1. Successful authentication

The authentication flow is initialized with a password/check that supplies username and password. 

HTTP Request - /public/authentication/password/check/

POST https://iam-host.com/auth/rest/public/authentication/password/check
{
    "username": "john.doe@ergon.ch",
    "password": "password0"
}

HTTP Response - /public/authentication/password/check/

The response is a HTTP 200 OK with a nextAuthStep Attribute that indicates that a second authentication factor is required.

200 OK
{
    "meta": {
        "type": "jsonapi.metadata.document",
        "timestamp": "2018-12-04T09:39:35.645Z"
    },
    "data": {
        "type": "authentication.session",
        "id": "c7a96a75-fba4-465b-aa12-7dd70e4105ce",
        "attributes": {
            "nextAuthStep": "OTP_REQUIRED"
        }
    }
}

HTTP Request - /public/authentication/otp/check/

The OTP code is supplied with a otp/check REST call.

POST https://iam-host.com/auth/rest/public/authentication/otp/check
{
    "otp": "SHpXuypb"
}

HTTP Response - /public/authentication/otp/check/

The response is a HTTP 200 OK response and authentication is successfully completed:

200 OK
{
    "meta": {
        "type": "jsonapi.metadata.document",
        "timestamp": "2018-12-04T09:42:30.255Z"
    },
    "data": {
        "type": "authentication.session",
        "id": "c7a96a75-fba4-465b-aa12-7dd70e4105ce",
        "attributes": {}
    }
}