question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

http post different Behavior in browser and IOS emulator

See original GitHub issue

Hi ,

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:closed
  • Created 8 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jgw96commented, Mar 28, 2016

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!

0reactions
ionitron-bot[bot]commented, Sep 1, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

http post different Behavior in browser and IOS emulator
Hi , I have below http post, throwing error when i am using IOS emulator. If i use my ionic app from browser,...
Read more >
Mobile Browser Emulation (Mozilla, iPhone & More)
Learn how to emulate mobile browesers like iOS Gecko, Amazon Silk, Safari, and CPU iPhone with Dotcom-Monitor's BrowserView platform.
Read more >
iPhone Browser simulator for Windows?
You can simulate the iPhone user agent in Safari 5 if you set up the Developers menu item in Preferences>Advanced.
Read more >
How to Use Mobile Emulation Mode in Chrome
Start Chrome, navigate to the web page you want to test and open the Developer Tools (Menu > Tools > Developer Tools, Cmd...
Read more >
Emulation | Polypane, The browser for ambitious developers
Polypane lets you emulate different user preference media queries, device properties like pixel ratio and user agent, and network conditions…
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found