This is my first ever post in Stack Overflow. I am also returning to my programming roots after 16 years. Please pardon me if I am not following appropriate convention. I have been trying for more than a week to get the authentication API from iHealthLabs to work.
I am trying to process HTML that is returned by the iHealthLabs API. I need to process the HTML to make the links clickable when the page is launched from the ngCordova InAppBrowser plugin (which is otherwise turned to plain text, I believe due to $sanitize
). I am using Angular's $http
.
In order for $http
to not process the response as JSON, I have set the transformResponse
option to []
as below:
var req = {
url: "http://sandboxapi.ihealthlabs.com/OpenApiV2/OAuthv2/userauthorization/?callback=JSON_CALLBACK&client_id=d9bc6644db6f4acfbf64748bac4782a1&response_type=code&redirect_uri=http://localhost:8100/ihealthdata?userid=john&APIName=OpenApiBP&RequiredAPIName=OpenApiBG+OpenApiBP&IsNew=true",
method: 'jsonp',
cache: false,
transformResponse: []
};
Here is the request:
$http(req).
success(function(data, status, headers, config) {
$scope.html = data;
}).
error(function(data, status, headers, config) {
});
However, I get the following error: Uncaught SyntaxError: Unexpected token <
I was wondering if there is something obvious I am missing or if I have to use the Angular Interceptors to trap the response and go from there.
Thank you for your help.