@esm-js/jira.js
Version:
A comprehensive JavaScript/TypeScript library designed for both Node.JS and browsers, facilitating seamless interaction with the Atlassian Jira API.
17 lines (13 loc) • 505 B
text/typescript
import type { Config } from '../../config';
import { createBasicAuthenticationToken, createOAuth2AuthenticationToken } from './authentications';
export async function getAuthenticationToken(
authentication: Config['authentication'] | undefined,
): Promise<string | undefined> {
if (!authentication) {
return undefined;
}
if ('basic' in authentication) {
return createBasicAuthenticationToken(authentication.basic);
}
return createOAuth2AuthenticationToken(authentication.oauth2);
}