@blackbaud/auth-client

中文文档
2.78.0发布于 2024/02/23MITESM + CJS近 30 天下载 8121

Provides methods for obtaining an authentication token from the Blackbaud authentication service.

此软件包已被标记为弃用

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

原始使用文档
文档目录5 节
  1. Installation
  2. Usage
  3. Prerequisites
  4. ES6/TypeScript
  5. Vanilla JavaScript/ES5

@blackbaud/auth-client

npm status coverage

Provides a client-side library for interacting with Blackbaud authentication.

Installation

  • Ensure that you have Node v6+ and NPM v3+. To verify this, run node -v and npm -v at the command line.
  • Install the library as a dependency of your project by running npm install @blackbaud/auth-client --save in your project's folder.

Usage

Prerequisites

The auth client library makes extensive use of ES6-style Promises, so in order to support browsers that do not yet have native support for Promises (such as Internet Explorer 11) you will need to include a Promise polyfill such as es6-promise and use the auto-polyfill feature of the library so that Promise is added to the global environment. This will need to be loaded on your page before the auth client library.

ES6/TypeScript

There are two classes available in this package: BBAuth and BBOmnibar. BBAuth allows you to retrieve an auth token from the Blackbaud authentication service, and BBOmnibar allows you to render the omnibar at the top of the page.

You can use these in combination to integrate your application with Blackbaud authentication.

import { BBAuth, BBOmnibar } from '@blackbaud/auth-client';

// Make an initial attempt to get an auth token.  If the user is not currently logged in,
// this code will redirect the browser to Blackbaud's sign-in page.
BBAuth.getToken()
  .then(() => {
    // The user is logged in; load the omnibar.
    BBOmnibar.load({
      serviceName: 'Some service name'
    });

    // Add additional logic to bootstrap the rest of the application.
  });

To make authorized requests to your web service endpoints you will also use the BBAuth.getToken() method to retrieve a token that can be added as a header to your request. Since retrieving a token is an asynchronous operation, this method returns a Promise, so you should wait until the Promise is resolved before making your web request.

import { BBAuth } from '@blackbaud/auth-client';

BBAuth.getToken()
  .then((token: string) => {
    const xhr = new XMLHttpRequest();

    xhr.open('GET', url, true);

    xhr.setRequestHeader('Authorization', 'Bearer ' + token);

    xhr.send();
  });

Vanilla JavaScript/ES5

Auth client is also distributed as a UMD bundle. If you're using ES5 with Node or a tool like Browserify you can require() it:

var BBAuthClient = require('@blackbaud/auth-client');

BBAuthClient.BBOmnibar.load({
  serviceName: 'Some service name'
});

If you're not using a module loader or prefer to reference the file via CDN, you can load the file onto your page via <script> tag.

If using NPM, add a reference to dist/bundles/auth-client.umd.js or concatenate that file with the rest of your page's JavaScript.

If using the SKY UX CDN, add a reference to https://sky.blackbaudcdn.net/static/auth-client/[VERSION]/auth-client.global.min.js, where [VERSION] is the version you'd like to use. All versions published to NPM are also available through the CDN. You can also reference the latest major version. Example versions:

  • https://sky.blackbaudcdn.net/static/auth-client/2.24.0/auth-client.global.min.js
  • https://sky.blackbaudcdn.net/static/auth-client/2/auth-client.global.min.js

You can now access it via the global BBAuthClient variable:

// BBAuthClient is global here.
BBAuthClient.BBOmnibar.load({
  serviceName: 'Some service name'
});

版本与发布记录

@blackbaud/auth-client 共发布 120 个版本,首次发布于 2017/04/12;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.78.0latest2024/02/232 年前
2.77.02024/02/232 年前
2.76.02024/02/222 年前
2.74.02024/01/242 年前
2.73.02024/01/122 年前
2.72.02024/01/112 年前

其他发布通道:next → 2.22.0-rc.0。

关于 @blackbaud/auth-client 的常见问题

@blackbaud/auth-client 是什么?

Provides methods for obtaining an authentication token from the Blackbaud authentication service.注意:该包已被作者标记为弃用——Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

如何安装 @blackbaud/auth-client?

在项目目录运行 npm install @blackbaud/auth-client,或使用 pnpm add / yarn add / bun add。

@blackbaud/auth-client 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/blackbaud__auth-client 是否存在。

@blackbaud/auth-client 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@blackbaud/auth-client 可以商用吗?

@blackbaud/auth-client 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@blackbaud/auth-client 的下载量有多少?

根据 npm 官方下载统计,@blackbaud/auth-client 在 2026/10/09 – 2026/11/07 这 30 天内被下载 8,121 次,日均约 271 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@blackbaud/auth-client 还在维护吗?

最新版本 2.78.0 发布于 2024/02/23(2 年前);至今共发布 120 个版本,其中过去 12 个月发布了 0 个;首次发布于 2017/04/12。作者已将其标记为弃用,新项目建议寻找替代方案。