Custom User Validation

Catalyst Authentication allows you to authorize and validate your end-users using a custom Basic I/O function on the event of a sign-up to your Catalyst application. You can write your own logic and process the credentials that the user provides through this function, and grant access to your application.

A sample code for a Custom User Validation function is given below.

    
copy
import json
import zcatalyst_sdk
def handler(context, basicio):
app = zcatalyst_sdk.initialize()
auth_service = app.authentication()
request_details = auth_service.get_signup_validation_request(basicio)
if request_details:
print("response :",request_details)
if 'spam.com' in request_details['user_details']['email_id']:
basicio.write(json.dumps({
'status': 'failure'
}))
else:
basicio.write(json.dumps({
'status': 'success',
'user_details': {
'first_name': 'Amelia',
'last_name': 'Jack',
'role_identifier': 'cx_role',
'org_id': 1012535411
#If you are providing the Org ID, it must be copied from the console.
}
}))
context.close()

To test this function, you can pass the details of the user in the following .JSON format:

    
copy
{
"request_type": "add_user",
"request_details": {
"user_details": {
"email_id": "emmy@zylker.com",
"first_name": "Emma",
"last_name": "Thompson",
"org_id": "432567817",
"role_details": {
"role_name": "Moderator",
"role_id": "879"
}
},
"auth_type": "web"
}
}

Last Updated 2023-12-18 16:20:08 +0530 +0530

RELATED LINKS

Authentication

ON THIS PAGE
ACCESS THIS PAGE