Example of how to include credentials
Manaf-Ibrahim opened this issue · comments
Manaf Ibrahim commented
Hi,
I am wondering if there was any examples of how to override the default config value for credentials? The endpoint I am querying requires a username and password.
Any help with this would be greatly appreciated.
Jan Hommes commented
@Manaf-Ibrahim it depends on the authentication mechanism used. Basic auth is simple:
o('someUrl', {
headers:
{
'Authorization': `Basic ${btoa('username:password')}`
}
});
Others are more complex, as you might need to get an access token first or they are using a cookie for authentication.