Using JupyterHub as an OAuth2 provider

I have a rest-api application running in a docker container. Would it be possible to use JupyterHub as an OAuth2 provider using the generic-oauth provider in traefik-forward-auth?

Should I register the application I want to authenticate as a service? The docker container is running on a different machine. The are within the same network.