--- title: "Configure the Basic I/O function" url: https://docs.catalyst.zoho.com/en/tutorials/hosted-login-app/python/configure-function/ description: "Create a simple Basic or React application using the features of Catalyst Hosted Authentication that provides user sign-up, application login, password reset, and implements sign-in using prevalent federated identity providers." last_updated: 2025-11-19T15:07:41Z service: All Services type: tutorial related_links: - name: "Basic I/O Functions" url: /en/serverless/help/functions/basic-io/ - name: "Functions Directory Structure" url: /en/cli/v1/project-directory-structure/functions-directory --- # Configure the Function Now, we will begin coding the authorization portal application by configuring the function component. The [function’s directory](https://docs.catalyst.zoho.com/en/cli/v1/project-directory-structure/functions-directory), (`functions/authorization_portal_function`), contains: * The `main.py` main function file * The `catalyst-config.json` configuration file * Handler files * [`requirements.txt`](https://docs.catalyst.zoho.com/en/cli/v1/project-directory-structure/functions-directory/#requirementstxt-file) file to mention any external libraries you might add You will be adding code in the `main.py` file. The Basic I/O function contains the following functionalities: * The end-user's details will provided as a JSON input to the *Custom User Validation* function. * The function is coded to implement a custom logic based upon which the end-user will either be authenticated or denied. > **Note:** For the purpose of this tutorial, we have coded a logic for the Custom User Validation function where if the user's email provider is anyone other than Zylker Technology (`@zylker.com`) the end-user will not be able to sign up to the application. You can either use the same or code a logic of your preference. Now, let’s begin coding the Basic I/O function. Copy the code given below and paste it in the `main.py` file in the `functions/authorization_portal_function` directory of your project, and save the file. You can use any IDE of your choice to work with the application’s files. > **Note:** Please go through the code in this section to make sure you fully understand it. **main.py** ```javascript import json import zcatalyst_sdk def handler(context, basicio): catalyst_app = zcatalyst_sdk.initialize() auth_service = catalyst_app.authentication() request_details = auth_service.get_signup_validation_request(basicio) if request_details: if "@zylker.com" in request_details["user_details"]["email_id"]: basicio.write(json.dumps({"status": "failure"})) //The user has failed authentication else: //The actions that occur in the event of a successful authentication can be customized basicio.write( json.dumps( { "status": "success", "user_details": { "first_name": request_details["user_details"]["first_name"], "last_name": request_details["user_details"]["last_name"], "email_id": request_details["user_details"]["email_id"], "role_identifier": "App User", //If you want to override the default role, you can specify the role id/name here. 'org_id': "orgId" //If you are providing the Org ID, make sure it is copied exactly from the console. }, } ) ) context.close() ``` > **Note:** You can also use this [SDK](https://docs.catalyst.zoho.com/en/sdk/python/v1/cloud-scale/authentication/custom-user-validation/) to code your own custom logic instead of the one implemented above. The function directory is now configured. We can now proceed to configuring the client directory.