## Introduction
The Xiaomi Home Assistant integration is a popular choice for home automation, but it can be frustrating when issues arise. In this article, we will explore a common problem where the HA adds a plugin and returns an authorization failure. We will delve into the steps to reproduce the issue, the expected behavior, and provide a detailed solution to resolve the problem.
## Steps to Reproduce the Issue
To reproduce the issue, follow these steps:
1. Install Homebrew if it's not already installed.
2. Update Homebrew and install Python and Git.
3. Create a Home Assistant directory and navigate to it.
4. Create a Python virtual environment and activate it.
5. Install the required packages, including Home Assistant, zlib_ng, isal, and bleak.
6. Install the hacs plugin and ha_xiaomi_home integration.
7. Configure Home Assistant to start automatically.
## Expected Behavior
After completing the above steps, you should be able to authorize the Xiaomi Home Assistant integration without any issues. However, in this case, the authorization fails, and an error message is displayed.
## Solution
To resolve the issue, you need to modify the `config_flow.py` file in the `xiaomi_home` directory. Specifically, you need to update the `__check_oauth_async` function to handle the SSL certificate verification error. You can do this by adding the following code:
```python
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
```
This code creates an unverified HTTPS context, which will allow the integration to connect to the Xiaomi servers without verifying the SSL certificate.
## Conclusion
In conclusion, the Xiaomi Home Assistant integration issue can be resolved by modifying the `config_flow.py` file to handle the SSL certificate verification error. By adding the above code, you should be able to authorize the integration without any issues. If you encounter any further problems, feel free to comment below, and we will do our best to assist you.