Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is Fetch limited to https?

ANSWERED

I cannot get Fetch working with http://. Is it possible to use Fetch with http:// instead of https:// addresses?
Or get data from such a server in another way?

Best Answer
1 BEST ANSWER

Accepted Solutions

Good news everyone!

 

Version 2.42 of the iOS will include this fix!

View best answer in original post

Best Answer
28 REPLIES 28
Best Answer

Yes I am. Good to know. 

Best Answer

In the future, would it be possible to enable the ATS bypass for local devices, for example, an IoT or media device? One of my devices has an intranet-only REST API that only responds to HTTP requests.

 

According to the link, it looks like the "NSAllowsLocalNetworking" key might (I'm not an iOS developer) allow for this. Right now, I get a 400 error when I communicate with a local HTTP server, which is expected and leads me to believe it isn't already enabled.

 

I have ways to work around this on my own network, but wouldn't be usable if I wanted to publish my app on the Gallery when it becomes available.

 

Best Answer

Good news everyone!

 

Version 2.42 of the iOS will include this fix!

Best Answer

Did this change make the final version of 2.42? I'm sure it's my code at this point, but wanted to make sure the change was in before I start debugging.

Best Answer

I get an empty response for an HTTP request that I know returns data. I am using Samsung Galaxy 8. Can the Fitbit Fetch API perform an HTTP request?

Best Answer
0 Votes

This is still an issue on Android for version 2.68.

It works fine with https, but for http it gives a 400 error regardless of the url.

Let me know if you'd need me to give any other information.

Best Answer

This is still an issue for Android version 2.69!! 😭 http urls return nothing whereas https returns content.

 

I am very disappointed! I first developed my app using the Fitbit OS Simulator before I received my Fitbit Versa. In the simulator, both https and http work fine. So, when I was testing the app in the simulator, it was working fine. But on the actual device it was erroring out! I spent a few hours before I stumbled on this thread! The simulator gave me false hope that my app will work!

 

Please Fitbit, please please fix this soon! 😭

Best Answer

This still seems to be an issue with http..anyone have any updates or fixes? 

Best Answer
0 Votes

I have a hacky workaround as of now. Try using https://script.google.com/ to query the insecure http:// url. And use this script instead of the original in your app. It is like wrapping around the insecure url in a secure version.

 

This has obvious limitations. You can only do around 20,000 (or is it 50,000) fetch calls in a day. For a more permanent solution, you may need to run your own backend. But for me, this works as I have an app I made that only I use as of now.

 

I may need to come up with a more robust backend for my app if I need to make this mainstream.

Best Answer
0 Votes

@shermj scratch that.

I have a better solution. Use a url shortener like bit.ly. It will create an https url for you and query that.

 

:activate-troll-face: Yes! Maximum hackery!

Edit: Confirmed working in Fitbit Studio using an actual Fitbit Versa (not the simulator, because the http:// urls work in the simulator anyway!! What?)

Best Answer

Awesome! Thank you I'll try this Smiley Happy

Best Answer
0 Votes

It's a problem on Android too. Please notice, I'm trying to connect to "localhost", so it should work according to Fetch API documentation

TypeError: Failed to fetch - Please use https:// when communicating with internet endpoints. https://dev.fitbit.com/reference/companion-api/fetch/

Best Answer
0 Votes

please provide the script, the link shows "no projects"

Best Answer
0 Votes

I am using IOS app ver 3.12 (913) and I still see the error that the fetch wants me to use https://

Best Answer
0 Votes

I tried using bitly, but didn't work for me.

Gives TypeError: Failed to fetch

Best Answer
0 Votes

Hello,

This issue is still valid android user. when I try to send the data to local server with http, I get fetch fail but the code works well when I send the data to cloud firebase. Anyone to guide me? steps or configurations needed will be much appreciated

Best Answer
0 Votes

http will only work with specific IPs, which usually equate to localhost. A workaround is to write a server for your Android device (localhost) that can accept http from the Fitbit app, and forward those to your LAN server.

Installing a non-self-signed (https) cert on the server would be nicer, but that can be difficult.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Thanks. I installed https on localhost and I should be able to transfer the data.

Best Answer