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)