In nginx, you can do basic auth by using directive auth_basic like
auth_basic "Git Login";
auth_basic_user_file "/var/www/html/git/htpasswd";
Is there a way to authenticate with an API server instead of against htpasswd file? I am building an application similar to heroku where users sign up and I generate an API key for them. They will use command line to login. With the htpasswd setup, it is correctly authenticating with username and password but I want a way to authenticate against my API server instead of htpasswd. How do I go about doing this?