andig / fritzapi

Home automation API for Fritz!Box, Fritz!DECT and FRITZ!Powerline devices
MIT License
139 stars 27 forks source link

Cors issue #34

Closed JensC closed 4 years ago

JensC commented 4 years ago

Hi,

I am running into an cors issue with my react app, fritzapi and a fritz box 7590 (fw: 7.12). My FF console says in German:

"Quellübergreifende (Cross-Origin) Anfrage blockiert: Die Gleiche-Quelle-Regel verbietet das Lesen der externen Ressource auf http://fritz.box/webservices/homeautoswitch.lua?0=0&sid=51512c8b4514c702&switchcmd=getdevicelistinfos. (Grund: CORS-Anschlag schlug fehl).".

After installing a FF plugin "Allow Cors" I got it to work, but it needs a lot of fine tuning to make other sites working again. The used node module in fritzapi "request" is outdated and doesn't allow cors handling either. Is there an easy way to get fritzapi working without any additional plugins?

Thanks a lot, Jens

andig commented 4 years ago

How are you even using it? What role does your browser play in this?

JensC commented 4 years ago

With fritzapi I was trying to comunicate with the fritzbox, without fritzapi I would normaly use native fetch calls but needed to handle the used protocol. Am I doing something wrong? Fritzapi works fine with your example.js on bash for example. The react app runs some kind of dev-web-server. So I am connecting to that ... currently on localhost:3000

andig commented 4 years ago

You just can‘t use it from a browser, its not designed for that purpose.

JensC commented 4 years ago

Thanks