🎆 Authorization Mixin for Barktler
yarn add @barktler/mixin-authorization
# Or
npm install @barktler/mixin-authorization --save
import { createBearerAuthorizationMixin } from "@barktler/mixin-authorization";
import { YourAPI } from "somewhere";
const api: YourAPI = new YourAPI();
api.useMixin(createBearerAuthorizationMixin({
getTokenFunction: async () => getYourToken(),
}));
import { createBasicAuthorizationMixin } from "@barktler/mixin-authorization";
import { YourAPI } from "somewhere";
const api: YourAPI = new YourAPI();
api.useMixin(createBasicAuthorizationMixin({
getTokenFunction: async () => getYourToken(),
base64: true, // default true, false for not encode
}));
See Barktler Documents.