@atlassian/atlassian-oauth2

中文文档
0.9.0发布于 2025/08/28MITCommonJS近 30 天下载 1.5万

Atlassian Connect OAuth2 library

此软件包已被标记为弃用

This package is deprecated as part of ECORFC-621. Atlassian Connect frameworks and supporting libraries will reach end of support in December 2026. Migrate Connect apps to Forge: https://developer.atlassian.com/platform/adopting-forge-from-connect/

原始使用文档

atlassian-oauth2

A node module which facilitates the exchange of an add-ons JWT token for an OAuth 2 bearer token, following the RFC-7521 and RFC-7523 specifications.

Install

npm i @atlassian/atlassian-oauth2

Usage

var oauth2 = require('@atlassian/atlassian-oauth2');

var options = {
    hostBaseUrl: 'https://instance.atlassian.net',
    oauthClientId: '{oauth client id your add-on was given at installation}',
    sharedSecret: '{the shared secret your add-on was given at installation}',
    userKey: '{the userkey of the user to retreive the token for}',
    scopes: ['{an array of scopes requested}']
};

oauth2.getAccessToken(options).then(function (token) {
    console.log(token);
    // token.access_token = '{your access token}'
    // token.expires_in = '{expiry time}'
    // token.token_type = 'Bearer'
});

版本与发布记录

@atlassian/atlassian-oauth2 共发布 5 个版本,首次发布于 2025/05/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.9.0latest2025/08/281.2 年前
0.8.02025/07/041.3 年前
0.7.02025/06/271.4 年前
0.6.02025/05/191.5 年前
0.5.12025/05/151.5 年前

关于 @atlassian/atlassian-oauth2 的常见问题

@atlassian/atlassian-oauth2 是什么?

Atlassian Connect OAuth2 library注意:该包已被作者标记为弃用——This package is deprecated as part of ECORFC-621. Atlassian Connect frameworks and supporting libraries will reach end of support in December 2026. Migrate Connect apps to Forge: https://developer.atlassian.com/platform/adopting-forge-from-connect/

如何安装 @atlassian/atlassian-oauth2?

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

@atlassian/atlassian-oauth2 支持 TypeScript 吗?

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

@atlassian/atlassian-oauth2 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@atlassian/atlassian-oauth2 可以商用吗?

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

@atlassian/atlassian-oauth2 的下载量有多少?

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

@atlassian/atlassian-oauth2 还在维护吗?

最新版本 0.9.0 发布于 2025/08/28(1.2 年前);至今共发布 5 个版本,其中过去 12 个月发布了 0 个;首次发布于 2025/05/15。作者已将其标记为弃用,新项目建议寻找替代方案。