Couchbase Sync-gateway and webapp authentication both at once

We are building mobile app including offline capability with Couchbase mobile solution for existing web application, we use basic authentication to connected to sync-gateway via websocket which is only to connect to sync-gateway and sync couchbase doc but we need to check the user’s authenticate with our primary app , which has DB we check the authenticate first and then connect to Couchbase sync-gateway , we use Customer authentication for that Customer authentication

There is another approach for authentication,which is using Implicit Flow Here we have to connect keycloak with web app’s DB, is this doable approach,

pls any one explain which is the best way of authentication with web app’s DB and connect to the sync-gateway

If you are using a OIDC provider such as Keycloak, then you can follow the instructions in this tutorial