# Exercise 2: Authentication ## Overview In this exercise, you'll learn how to authenticate with the Zerto API using Keycloak. You'll create a client and establish a connection to your ZVM. ## Objectives - Create a Keycloak client - Configure authentication parameters - Test the connection to ZVM - Handle authentication errors ## Time 10 minutes ## Prerequisites - Completed Exercise 1 - Valid ZVM credentials - Client ID and secret ## Exercise Steps 1. Set up your configuration 2. Create the Keycloak client 3. Test the connection 4. Handle authentication errors ## Working Directory The `working` directory contains: - `auth.py` - Template to complete ## Solution The `solution` directory contains: - `auth.py` - Complete working example ## Key Concepts - Keycloak authentication - Client credentials flow - Error handling - Connection management ## Common Issues - Invalid credentials - SSL certificate issues - Network connectivity problems ## Next Steps Proceed to Exercise 3: Site Discovery to start working with Zerto sites.