hi
i have a question about using Amplitude Dashboard Rest API
i want to get the data in my web project (Its using react.js, typescript ...)
So i used Fetch and also used Axios for Dashboard Rest APi
When i used Axios, it have CORS error ( I am not using a VPN )
When i used Fetch, it have 401 error, but same code with same key in node.js is woking.
So, could i call dashboard REST API in my web project ?
const CREDENTIALS = `${AMPLITUDE_API_KEY}:${AMPLITUDE_SECRET_KEY}`;<br />const ENDPOINT_URL = 'https://amplitude.com/api/2/funnels';<br /><br />export async function request(eventKeys, options) {<br /> const encodedCredentials = window.btoa(CREDENTIALS);// credentials to base64 <br /> const params = new URLSearchParams();<br /><br /> eventKeys.forEach((key) => params.append('e', JSON.stringify({ event_type: key })));<br /> params.append('start', options?.start ?? dayjs().subtract(1, 'month').format('YYYYMMDD'));<br /> params.append('end', options?.end ?? dayjs().format('YYYYMMDD'));<br /><br /> console.log(`${ENDPOINT_URL}?${params.toString()}`);<br /><br /> const response = await fetch(`${ENDPOINT_URL}?${params.toString()}`, {<br /> method: 'GET',<br /> mode: 'no-cors',<br /> headers: {<br /> Authorization: `Basic ${encodedCredentials}`,<br /> },<br /> });<br /><br /> console.log('[response]', response.text());<br /><br /> return response.text();<br />}<br />