Skip to Main Content

Programming Languages & Frameworks

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Fetch Eloqua API using Axios with Basic Authentication

MattZ-OracleMay 16 2022 — edited May 16 2022

Hi There,
I have been running into issue 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.
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},
auth: {username: username, password: password }
}).then(function(data) {
console.log(data);
console.log(headers);
}).catch(function(error) {
console.log('Error on Authentication');
//console.log(username);
});
};
export default List;
Screen Shot 2022-05-16 at 12.10.19 PM.png

Comments

User_C7DAK

Same issue - following

1 - 1

Post Details

Added on May 16 2022
0 comments
784 views