How to use @okta/oidc-middleware - 3 common examples

To help you get started, we’ve selected a few @okta/oidc-middleware examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oktadeveloper / okta-node-express-typescript-vue-example / src / middleware / sessionAuth.ts View on Github external
export const register = ( app: any ) => {
	// Create the OIDC client
	const oidc = new ExpressOIDC( {
		client_id: process.env.OKTA_CLIENT_ID,
		client_secret: process.env.OKTA_CLIENT_SECRET,
		issuer: `${ process.env.OKTA_ORG_URL }/oauth2/default`,
		redirect_uri: `${ process.env.HOST_URL }/authorization-code/callback`,
		scope: "openid profile"
	} );

	// Configure Express to use authentication sessions
	app.use( session( {
		resave: true,
		saveUninitialized: false,
		secret: process.env.SESSION_SECRET
	} ) );

	// Configure Express to use the OIDC client router
	app.use( oidc.router );
github okta / samples-nodejs-express-4 / common / sample-web-server.js View on Github external
module.exports = function SampleWebServer(sampleConfig, extraOidcOptions, homePageTemplateName) {

  const oidc = new ExpressOIDC(Object.assign({
    issuer: sampleConfig.oidc.issuer,
    client_id: sampleConfig.oidc.clientId,
    client_secret: sampleConfig.oidc.clientSecret,
    appBaseUrl: sampleConfig.oidc.appBaseUrl,
    scope: sampleConfig.oidc.scope,
    testing: sampleConfig.oidc.testing
  }, extraOidcOptions || {}));

  const app = express();

  app.use(session({
    secret: 'this-should-be-very-random',
    resave: true,
    saveUninitialized: false
  }));

@okta/oidc-middleware

OpenId Connect middleware for authorization code flows

Apache-2.0
Latest version published 19 days ago

Package Health Score

78 / 100
Full package analysis

Popular @okta/oidc-middleware functions