The validate_credentials method is used to validate user credentials at the moment of establishing a connection between the Apination and application

cn_app_validate_credentials

OK-Response

A successfull response must be returned, when credentials pass validation:

{
    "data": {
        "success": true
    }
}

Unauthorized-response

When credentials do not pass validation, an AuthError must be thrown. Lambda-Proxy will convert such error to HTTP 401-Unauthorized response to the HUB

NodeJS example

function validateCredentials(credentials) {
    // TODO: implement validation logic
    throw new Object.assign(new Error('Invalid Credentials'), { name: 'AuthError' });
}

exports.handler = function(event, context) {
    try {
        validateCredentials(event.credentials);
        context.succeed({ data: { success: true } });
    }
    catch(err) {
        context.fail(err);
    }
}

Python example

# TODO