Sign Up

How do I add a layer of authentication to the Snapshot SDK?

Make the SDK listen locally then use a proxy server such as Nginx or Traefik to authorize and route requests to it.
 
Here is an example of how to do it using Nginx with HTTP Basic Authentication:
1) Ensure the Snapshot SDK container is not listening publicly. Then you use NGINX as a middleware to proxy requests to it.
There are 2 variations to this setup:
   A. Running Nginx separately besides Docker.   This is recommended if you are not familiar with Docker.
   B. Running Nginx and the SDK in Docker then using Docker networking to connect the two containers. This is recommended if  you are familiar with Docker.
 
Here is how to set up A:
1. Run the Snapshot SDK but make it listen on localhost.  In the run command, don’t include –net=host option. Then bind to only the localhost interface like this -p 127.0.0.1:8002:8080 instead of binding to all interfaces like this -p 8002:8080
 
2. Install Nginx on the HOST and add a server block that will proxy requests to the SDK container. Here is an example for 127.0.0.1:8002
server {
server_name _;
location / {
    proxy_pass http://
127.0.0.1:8002;
}
listen 0.0.0.0:8080;
}
 
At this point you should be able to make Un-Authenticated ALPR requests to SERVER-IP:8080 the same way you do the SDK directly.
 
3. Add HTTP Basic Authentication to the server block.