UNPKG

@sargonpiraev/hh-api-client

Version:

A TypeScript client for the HeadHunter API, generated from the official OpenAPI specification.

14 lines (13 loc) 357 B
export const getAuthToken = async (auth, callback) => { const token = typeof callback === 'function' ? await callback(auth) : callback; if (!token) { return; } if (auth.scheme === 'bearer') { return `Bearer ${token}`; } if (auth.scheme === 'basic') { return `Basic ${btoa(token)}`; } return token; };