Libraries
    Preparing search index...

    Function authorizationCodeScheme

    • Create an OAuth 2.0 Authorization Code authentication scheme.

      The returned scheme exposes a flows property that the OpenAPI generator uses to automatically emit the correct oauth2 security scheme.

      Type Parameters

      • T

      Parameters

      Returns AuthenticationScheme<T>

      const oauth = authorizationCodeScheme({
      authorizationUrl: 'https://auth.example.com/authorize',
      tokenUrl: 'https://auth.example.com/token',
      scopes: { 'read:items': 'Read items' },
      authenticate: async (ctx) => {
      // validate Bearer token from ctx.headers.authorization
      return { succeeded: false };
      }
      });