I am trying to create a fetch request to access this API from Donorbox. Documentation:
https://github.com/donorbox/donorbox-api
I have successfully created this cURL request (redacted info):
curl -X GET --user login@email.com:YOUR_API_KEY https://donorbox.org/api/v1/campaigns
How should the credentials be included in a fetch request in a node file? I've tried including them in an Authorization header:
        const result = await fetch ('https://donorbox.org/api/v1/campaigns', {
            headers: {
                'Authorization': 'Basic ' + btoa('login@email.com:YOUR_API_KEY ')
            }
        })
        console.log(result)
    } catch (error) {
        console.log('ERROR')
        console.log(error)
    }
but node does not recognize btoa(). My other attempts without dtoa() have resulted in error 401.
 
    