Working with Hubtel Auth in Local Development
Hubtel Authentication is available as Docker images in Hubtel's private container registry, facilitating easy integration and local development. To use these images, you can download them individually by following these steps or by using the prepared Docker Compose file, which you can download here.
Using Docker Compose
Unzip the downloaded file into a directory of your choice. The unzipped folder will contain the following files:
- .npmrc: Contains credentials for setting up the USSD Simulator.
- docker-hubtel-auth.yml: Instructions for spinning up the various containers that make up the Hubtel Authentication project.
- Dockerfile: Instructions for setting up the USSD Simulator.
- lookup_api.py: A sample lookup API used for simulating the Authentication project.
- setup.http: Contains various API requests to set up a sample integration for development purposes.
How to Run Hubtel Authentication
Open a terminal and navigate to the directory containing the files:
shcd hubtel-auth
Install Python dependencies:
shpip3 install fastapi uvicorn
Run the API:
shpython3 lookup_api.py
Open another terminal in the same directory and start Docker Compose:
shdocker compose -f docker-hubtel-auth.yml up --build
Once all the services are started, open
setup.http
in VS Code with the Rest Client extension, and run the various API calls to create an integration.You can also modify the requests with your custom
accountlookupurl
to test against your local development.Note: Since the Docker container will be making API calls to a service hosted on your machine, replace
http://localhost
in your custom account URL withhttp://host.docker.internal
.
Conclusion
By following the steps outlined above, you can set up and run Hubtel Authentication locally using Docker Compose. This setup allows you to simulate the authentication process and test integrations in a controlled environment. Remember to adjust the API endpoints as needed to match your local development setup. Happy coding!
CHAT SAMMIAT