'Oauth2 prometheus config

Has anyone set up and used oauth2 on prometheus config in order to integrate SSO with keycloak? I tried the configuration below and I couldn't make it work.

prometheus.yml

 oauth2:
   client_id: "dsdsf-sdfssd-vfdsd-23sdfs"
   client_secret: "sl;k96,;di0l;skdf;'lsgjs;';fks"
   scopes : "https://keycloak/oauth2/authorize"
   auth_url : "https://keycloak/oauth2/authorize"
   token_url : "https://keycloak/oauth2/token"
   api_url : "https://keycloak/oauth2/userinfo"

The prometheus service is not starting after adding the above oauth2 lines.

[root@root]# systemctl status prometheus
● prometheus.service - Prometheus Server
   Loaded: loaded (/usr/lib/systemd/system/prometheus.service; enabled; vendor preset: disabled)
   Active: deactivating (stop-sigterm) (Result: exit-code) since Thu 2022-02-03 15:45:39 CET; 5s ago
  Process: 21596 ExecStart=/opt/prometheus-2.30.3.linux-amd64/prometheus --config.file /opt/prometheus/prometheus.yml --storage.tsdb.path=/data/prometheus --web.console.templates=/opt/prometheus/consoles --web.console.libraries=/opt/prometheus/console_libraries --storage.tsdb.min-block-duration=1h --storage.tsdb.max-block-duration=12h --storage.tsdb.retention.time=62d --log.level=debug --web.route-prefix=/prometheus --web.external-url=https://example.com/prometheus (code=exited, status=2)
 Main PID: 21596 (code=exited, status=2)
   CGroup: /system.slice/prometheus.service
           └─21182 /opt/prometheus-2.30.3.linux-amd64/prometheus --config.file /opt/prometheus/prometheus.yml 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source