Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@digitalbazaar/oauth2-client-registration-handler

OAuth2 Dynamic Registration handler for custom authorization servers.

oauth2

readme

Bedrock OAuth2 Dynamic Client Registration (@digitalbazaar/oauth2-client-registration-handler)

Node.js CI

OAuth2 Dynamic Registration handler for custom authorization servers.

Table of Contents

Background

Constraints/Limitations:

  • Only supporting client_credentials grant type for now.
  • Initial registration authentication method is bearer token.
  • Does not support the signed Software Statement mechanism.

Relevant specifications:

Security

TBD

Install

  • Node.js >= 16 is required.

To install locally (for development):

git clone https://github.com/digitalbazaar/oauth2-client-registration-handler.git
cd oauth2-client-registration-handler
npm install

Usage

This library exports a route handler to perform OAuth2 Dynamic Client Registration that can be added to an existing Bedrock or Express.js application.

import {clientRegistrationHandler} from '@digitalbazaar/oauth2-client-registration-handler';

app.post('/oauth2/register',
  clientRegistrationHandler({
    baseUrl: 'https://as.example.com',
    authentication: {
      strategy: 'bearer',
      validateInitialAccessToken: async ({token}) => {/* custom token validation logic */}
    },
    register: async ({registration, credentials: {initialAccessToken}}) => {
      // custom registration callback (saves client to database etc)
    },
    defaults: {
      clientSecretExpiresAt: 0, // never expires
      grantTypes: ['client_credentials'],
      tokenEndpointAuthMethod: 'client_secret_post'
    },
    logger: console
  }))
);

Contribute

See the contribute file!

PRs accepted.

If editing the Readme, please conform to the standard-readme specification.

Commercial Support

Commercial support for this library is available upon request from Digital Bazaar: support@digitalbazaar.com

License

New BSD License (3-clause) © Digital Bazaar

changelog

oauth2-client-registration-handler ChangeLog

2.0.0 - 2023-02-06

Changed

  • BREAKING: Convert to module (ESM).
  • BREAKING: Drop support for node <= 14.
  • Update dev deps to latest.
  • Update bnid to v3.0 (Converted to ESM module).
  • Use `c8@7.12.0` for coverage.

1.0.0 - 2020-10-09

  • Initial release. See git history for changes.