data-and-reporting-sdk
Version:
Data And Reporting product consists of API's which provides details of transaction and invoice informations about shell cards. The Shell Card Transaction and Invoice API is REST-based and employs Basic authentication in Version 1 and Oauth authentication
25 lines • 1.14 kB
JavaScript
/**
* Shell Data & Reporting APIsLib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
import { compositeAuthenticationProvider, requestAuthenticationProvider, } from './authentication.js';
export function createAuthProviderFromConfig(config, bearerToken) {
const authConfig = {
bearerToken: config.clientCredentialsAuthCredentials &&
requestAuthenticationProvider(config.clientCredentialsAuthCredentials.oAuthToken, bearerTokenTokenProvider(bearerToken, config.clientCredentialsAuthCredentials.oAuthTokenProvider), config.clientCredentialsAuthCredentials.oAuthOnTokenUpdate, {
clockSkew: config.clientCredentialsAuthCredentials.oAuthClockSkew,
}),
};
return compositeAuthenticationProvider(authConfig);
}
function bearerTokenTokenProvider(bearerToken, defaultProvider) {
return (token) => {
const manager = bearerToken();
if (defaultProvider === undefined) {
return manager.updateToken(token);
}
return defaultProvider(token, manager);
};
}
//# sourceMappingURL=authProvider.js.map