Skip to main content

Data Provider: Backend URL and Auth

The example uses a custom dataProvider and a Keycloak HTTP client to talk to the backend gateway. You can configure VITE_GATEWAY_URL for the backend URL.

src/dataProvider.ts
import { keycloakClient } from "./authProvider";
import raDataSpringBootRest from './ra-data-springboot-rest';
import { httpClient } from 'ra-keycloak';

const dataProvider = raDataSpringBootRest(
import.meta.env.VITE_GATEWAY_URL || 'http://localhost:8080/data',
httpClient(keycloakClient)
);

export { dataProvider };