Auth0 Home Blog Docs

CORS IONIC 3 EMULATE IOS NOT WORKING

ionic
cors
emulate

#1

My code

apiUrl = ‘https://mercapro.eu.auth0.com/dbconnections’;

data = {
client_id: “XXXXX”,
email: "XXXXX@gmail.com",
password: “toto”,
connection: “Username-Password-Authentication”,
user_metadata: { plan: ‘silver’, team_id: ‘a111’ }
}

constructor(private http: Http) {
console.log(‘Hello RestServiceProvider Provider’);
}

signUp() {
return new Promise(resolve => {
let headers = new Headers();
headers.append(‘Content-Type’, ‘application/json; charset=utf-8’);
let opts = new RequestOptions();
opts.headers = headers;
this.http.post(this.apiUrl + ‘/signup’, this.data, opts).subscribe(data => {
resolve(data);
console.log(JSON.stringify(data));
}, err => {
resolve(err);
console.log(‘error’);
console.log(JSON.stringify(err));
});
});
}

My error
{"_body":{“isTrusted”:true},“status”:0,“ok”:false,“statusText”:"",“headers”:{},“type”:3,“url”:null

Works in chrome with http://localhost:8100 but not working in simulator with file:// in Allowed Origins (CORS)


#2

Based on the description of the issue, your situation is likely the same one being tracked at (https://github.com/auth0/auth0-cordova/issues/42) so if you haven’t done so already you want to check that issue for some additional information.


#3

it is OK now
it is because --livereload
I became crazy…

I followed this tutorial ant it is OK :

http://blog.ionic.io/handling-cors-issues-in-ionic/
/api vs /customsite.com/api

Thanks


#4