Forum Discussion
Hi Roger, I don't think it is going to be possible for you to use the API the way you are trying to use it with Basic Authentication. I'm happy to be corrected, but using it that way means the API key has to be stored in JavaScript, which is easy to see via the source code of a course that is built, or can be seen in the requested headers via the browser console.
What needs to happen is that the request needs to go via a server side proxy on the server the content is hosted on. The API key would be stored server side. Your request would then go via the proxy, which would then make the request to the TalentLMS API, which would then relay back to your content. As far as I understand, this is the implementation that is required to a) Overcome any CORS errors. The same restrictions do not apply if the request is coming from a server and not a browser, and b) To make the request more secure.
Have you used the service Post Master before. It is worth setting that up and testing your API in there first. I was able to set one up quickly, and run tests and it worked successfully. however when using that same API locally, I have the CORs error too.
At least you will be able to confirm the API is working successfully.