cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
To help support our community and customers during the outbreak of Coronavirus (COVID-19), LogMeIn is providing free Emergency Remote Work Kits for Health Care Providers, Educational Institutions, Municipalities, Non-Profit organizations, and current LogMeIn customers. For more information please visit https://www.gotomeeting.com/work-remote
New Contributor

API BASIC Authentication Help

I keep getting an authentication error (401) any one see any issues with my code? 



var customerID = 'xxxx'; var clientSecret = 'yyyyy'; var encodedData = btoa(customerID + ':' + clientSecret); var authorizationHeaderString = 'Authorization: Basic ' + encodedData; var myHeaders = new Headers(); myHeaders.append("Access-Control-Allow-Origin","https://secure.logmein.com") myHeaders.append("Access-Control-Request-Headers", "https://airtables.com") myHeaders.append("Authorization" , authorizationHeaderString) var formdata = new FormData(); formdata.append("groups", ""); var requestOptions = { method: 'GET', mode: 'no-cors', headers: myHeaders, redirect: 'follow', }; fetch("https://secure.logmein.com/public-api/v2/hosts", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));