Skip to content

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

  1. Open a terminal and navigate to the directory containing the files:

    sh
    cd hubtel-auth
  2. Install Python dependencies:

    sh
    pip3 install fastapi uvicorn
  3. Run the API:

    sh
    python3 lookup_api.py
  4. Open another terminal in the same directory and start Docker Compose:

    sh
    docker compose -f docker-hubtel-auth.yml up --build
  5. 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.

  6. 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 with http://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!