Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
Convert cURL Request with an Embedded Credential URL to a fetch request

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.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

First of all, you can see what headers CURL sends to server by adding --verbose flag.

Secondly, you can convert your string to base64 encoding using function btoa.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!