UNPKG

@strongnguyen/oidc-provider

Version:

OAuth 2.0 Authorization Server implementation for Node.js with OpenID Connect

14 lines (11 loc) 332 B
/* * Loads the End-User's account referenced by the session. */ module.exports = async function loadAccount(ctx, next) { const { accountId } = ctx.oidc.session; if (accountId) { const account = await ctx.oidc.provider.Account.findAccount(ctx, accountId); ctx.oidc.entity('Account', account); } return next(); };