Function: createPostgresdbOAuthStores()
createPostgresdbOAuthStores(
__namedParameters):PostgresdbOAuthStores
Defined in: packages/auth-postgresdb/src/createPostgresdbOAuthStores.ts:47
Creates every durable OAuth store from a @ttoss/postgresdb db handle.
The stores are mechanical adapters between the @ttoss/auth-core store
contracts and Sequelize, so an app that already uses @ttoss/postgresdb does
not have to write them — nor reach around its own ORM to inject a raw pg
query runner.
Parameters
| Parameter | Type | Description |
|---|---|---|
__namedParameters | { db: { OAuthAuthCode: typeof OAuthAuthCode; OAuthClient: typeof OAuthClient; OAuthConsent: typeof OAuthConsent; OAuthRefreshToken: typeof OAuthRefreshToken; }; } | - |
__namedParameters.db | { OAuthAuthCode: typeof OAuthAuthCode; OAuthClient: typeof OAuthClient; OAuthConsent: typeof OAuthConsent; OAuthRefreshToken: typeof OAuthRefreshToken; } | The handle returned by @ttoss/postgresdb's initialize, with oauthModels among its registered models. |
__namedParameters.db.OAuthAuthCode | typeof OAuthAuthCode | - |
__namedParameters.db.OAuthClient | typeof OAuthClient | - |
__namedParameters.db.OAuthConsent | typeof OAuthConsent | - |
__namedParameters.db.OAuthRefreshToken | typeof OAuthRefreshToken | - |
Returns
Example
import { createPostgresdbOAuthStores, oauthModels } from '@ttoss/auth-postgresdb';
import { initialize } from '@ttoss/postgresdb';
const db = await initialize({ models: { ...oauthModels, User } });
const { clientStore, authCodeStore, consentStore, refreshTokenStore } =
createPostgresdbOAuthStores({ db });