Maker API CORS error?


#1

i'm trying to write some frontend code using maker API and when I do a get or a post, i get a CORS error. code is running on localhost . i tried hitting against my local and against the cloud api - same result.
what's the recommended way to access the api from a JavaScript app?


#2

really ? no one had this issue except me?


#3

Certainly not the only one. This thread has had a little discussion Cross origin.

Would help to have more info on what you are trying to do. I've managed to work this using a node package
http-cors-proxy - npm that creates a proxy address and works for my experiments.

There is also a chrome extension that helps with issues if you are working direct from the browser. Allow CORS: Access-Control-Allow-Origin - Chrome Web Store

Hope these help - others much more knowledgable can comment and there's a lot of advice to be found out there - Google is a friend.


#4

well, the issue for me is i'm trying to do this server-less... at least for now. just static files are sufficient to do what I need, so as such, i can't do a proxy or the like. wish i could configure maker api to add domains or ignore cross-origin


#5

A fix has been submitted for Maker API to allow local access to the endpoints with a configurable list of hosts to allow.


#6

Awesome! When will it be available for general consumption?


#7

We don't give ETAs on software releases. Not sure if it will make it in the next version or not. When I know, I will update.


#8

fantastic! thanks for the quick update


#9

That sounds great!

Thanks.


#10

Great news ( Thank you Hubitat !) Today's release.

  • Maker API added optional CORS support by host name for LAN connections only.

Any pointers as to how we implement this? Thanks for incorporating - will save some of the hoops I've been jumping through when I play with this...


#11

Add the hosts you want in the app

This will only work with local LAN connections.


#12

Is there a proper way to update the maker app short of removing/reinstalling and then reenabling devices?

Do I really need to list the many devices in my house (AKA, repurposed smartphones) that need access?

I'm running my own shim (proxy) but it would be nice to go direct.


#13

Wonderful.

Thank you.


#14

You just go into the app and select or change what you need to and click done.


#15

does it support wild cards? I am running off a local unhosted static file (just opening an html file from a browser). So in this case, i'd like to just add * or something of the sort.. or 192.168.. ?


#16

I don't know. Can't hurt to try. Let me know what you find out.