Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup a callback URL for an android application to receive POST requests from an API?

I would like to integrate a Withings smart scale into an Android app I am developing. I am following the getting started instructions in the withings developer documentation here. For this I need to register my app here and it requires a "Callback URL". Here are the details Withings provides for the Callback URL:

Partner URL called by our system to send notifications through HTTP POST requests. Make sure that your server can handle a HTTP HEAD request called to verify the validity of your url.

Your URL must :

  • be a valid URL, provided as a URL-encoded string. Please refer to w3schools URL encoding reference to learn more about URL encoding.

  • not be greater than 255 characters.

  • neither contain an IP or 'localhost'. Only port 80 and 443 are allowed.

How do I setup a callback URL for an android app that will be able to receive POST requests?

like image 524
Matti Granovsky Avatar asked Mar 04 '23 17:03

Matti Granovsky


1 Answers

A mobile application cannot be a callback URL because it has no static address for the API server to callback to. For example, your Android IP changes when you move from a mobile network, to your home wifi, to a coffeeshop.

What you need is a server in-between the mobile app and the Auth endpoint that can securely communicate login tokens. You can find a similar flow using a service like Auth0

like image 155
OneCricketeer Avatar answered Apr 07 '23 03:04

OneCricketeer