@jd-data-limited/easy-fm
Version:
easy-fm is a Node.js module that allows you to interact with a [FileMaker database stored](https://www.claris.com/filemaker/) on a [FileMaker server](https://www.claris.com/filemaker/server/). This module interacts with your server using the [FileMaker
24 lines (23 loc) • 850 B
JavaScript
/*
* Copyright (c) 2023. See LICENSE file for more information
*/
export function generateAuthorizationHeaders(credentials) {
switch (credentials.method) {
case 'filemaker':
return {
'Content-Type': 'application/json',
Authorization: 'Basic ' + Buffer.from((credentials).username + ':' + (credentials).password).toString('base64')
};
case 'claris':
return {
'Content-Type': 'application/json',
Authorization: (credentials).claris.fmid
};
case 'oauth':
return {
'Content-Type': 'application/json',
'X-FM-Data-OAuth-RequestId': (credentials).oauth.requestId,
'X-FM-Data-OAuth-Identifier': (credentials).oauth.requestIdentifier
};
}
}