Part 2 of annoying app dev gotchas - Making api requests

Cors is your best friend and worse enemy.

Enable cors in your backend (Startup.MobileApp.Cs):

config.EnableCors();

Add EnableCors attribute to your controller:

[EnableCors("*", "*", "*")]

Sample javascript for making request:

Azureservice.invokeApi("chat/GetAccessToken", {
    method: 'get',
    body: null,
    parameters: { deviceId: window.device.uuid || 'browser', }
}).then(function () {
    console.log('promise.success', arguments);
}, function () {
    console.log('promise.fail', arguments);
});