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.
To know more about the component instance authentication_service used below, please refer to this section.
A sample code for a Custom User Validation function is given below.
Parameters Used
Parameter Name | Data Type | Definition |
---|---|---|
basicio | Function | A Mandatory parameter. The Basic IO Catalyst function that allows to authorize and validate your end-users. |
copy
import json import zcatalyst_sdk def handler(context, basicio): app = zcatalyst_sdk.initialize() authentication_service = app.authentication() request_details = authentication_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" } }
Info : Refer to the SDK Scopes table to determine the required permission level for performing the above operation.
Last Updated 2025-03-28 18:24:49 +0530 +0530
Yes
No
Send your feedback to us
Skip
Submit