I am trying to get a user token by posting the username and password to an api.
To my understanding there are several ways to post an ajax call to an API (so you don't have to refresh the page):
call
api.site.com/token
fromsite.com
. But according to: another question you have to implement CORS on the server side to avoid the cross domain problem. But this isn't supported by most mobile browsers.call
site.com/api/token
which is a php script that curls posts the api (api.site.com) with the post data. Or calls a bash script that curls the post data.host api.site.com on the same server with site.com so you can access it i.e. site.com would call site.com/api/
Which method is the most efficient and used by facebook, Instagram ... the big guys?