http post different Behavior in browser and IOS emulator
See original GitHub issueHi ,
I have below http post, throwing error when i am using IOS emulator. If i use my ionic app from browser, it works totally fine. Please help…
var data = “username=” + credentials.username + “&password=” + credentials.password + “&grant_type=password&scope=read%20write&” + “client_secret=mySecretOAuthSecret&client_id=myclientid”;
var url = APP_URL + 'oauth/token';
return $http.post(url, data, {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json",
"Authorization": "Basic " + Base64.encode("myclientid" + ':' + "mySecretOAuthSecret")
}
}).success(function (response) {
var expiredAt = new Date();
expiredAt.setSeconds(expiredAt.getSeconds() + response.expires_in);
response.expires_at = expiredAt.getTime();
localStorageService.set('token', response);
return response;
});
// Error in IOS emulator
{“data”:null,“status”:0,“config”:{“method”:“POST”,“transformRequest”:[null],“transformResponse”:[null],“headers”:{“Content-Type”:“application/x-www-form-urlencoded”,“Accept”:“application/json”,“Authorization”:“Basic bW9iaWxlamhpcHN0ZXJhcHA6bXlTZWNyZXRPQXV0aFNlY3JldA==”},“url”:“http://localhost:8080/oauth/token",“data”:“username=admin&password=123123&grant_type=password&scope=read write&client_secret=mySecretOAuthSecret&client_id=myclientid”},“statusText”:"”}
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (2 by maintainers)
Hello! Thanks for opening an issue with us! Since it has been a little while since there was any activity on this issue i will be closing it, but feel free to respond back if your still having the issue! Thanks again!
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.