Federated login
The OIDC provider can delegate authentication to upstream identity providers (social login) via backends.federated. Users authenticate with Google/Microsoft/etc. and your provider issues its own tokens.
import { createOIDCProvider, oidcProviders } from "covara";
const { router, middleware } = createOIDCProvider({
issuer: "https://auth.myapp.com",
keys: { algorithm: "RS256" },
clients: [/* ... */],
backends: {
emailPassword: { enabled: true, validateUser: async () => { /* ... */ }, findUserById: async () => { /* ... */ } },
federated: [
oidcProviders.google({
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET,
}),
oidcProviders.microsoft({
clientId: env.MS_CLIENT_ID,
clientSecret: env.MS_CLIENT_SECRET,
tenantId: "common", // or a specific tenant
}),
oidcProviders.generic({
name: "custom",
clientId: "...",
clientSecret: "...",
issuer: "https://custom-idp.example.com",
scopes: ["openid", "email", "profile"],
}),
],
},
});