Created
March 1, 2014 21:33
-
-
Save rfaisal/9297739 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var access_token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsI...'; //saved from previous step | |
| var xhr = Titanium.Network.createHTTPClient(); | |
| xhr.setTimeout(30000); | |
| xhr.onload=function() { | |
| Ti.API.info('Protected Resource: '+this.responseText); | |
| }; | |
| xhr.onerror= function() { | |
| Ti.API.info('Error response: '+this.responseText); | |
| }; | |
| xhr.open('GET', 'https://my_resource_auth_server.azure-mobile.net/api/auth'); | |
| xhr.setRequestHeader("Content-Type", "application/json"); | |
| xhr.setRequestHeader("Accept", "application/json"); | |
| xhr.setRequestHeader("X-ZUMO-AUTH", access_token); // this is the magic line | |
| xhr.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment