Fetch Eloqua API using React Axios with Basic Authentication — Cloud Customer Connect
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register
Get Started with Redwood: Oracle Cloud SCM and Purchasing

Fetch Eloqua API using React Axios with Basic Authentication

I have been running into issues authenticating and fetching API using the basic auth.

I do get the 200 status on my response, but when I console log it shows that not authenticated. here's a code below:

import axios from "axios";

import React from 'react'

const List = () => {

const session_url = 'https://login.eloqua.com/id';

const username = 'instancename\\username';

const password = 'password';

const credentials = btoa(username + ':' + password);

const headers = {

  'Content-Type': 'application/json',

  'Accept': 'application/json',

  'Authorization': `Basic ${credentials}`

}

axios.get(session_url, {}, {

 headers: { headers}eloq,

auth: {username: username, password: password }

}).then(function(data) {

  console.log(data);

  console.log(headers);

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!