hi i am new in ionic 2.
facing pblm with authToken
i am calling a API with authkey
bt console telling authkey is missing. plz help me.
here is my code:
provider:
LockOpen(AuthToken: string, id) {
let headers = new Headers({
'AuthToken': AuthToken
});
let options = new RequestOptions({
headers: headers
});
return new Promise(resolve => {
this.http.post(this.myServer + "/WebRequest/LockOpen", options, id)
.map(res => res.json())
.subscribe(
data => { resolve(data) },
err => { console.log(err) }
);
});
}
in page.ts
openDoor(){
console.log('open clicked');
this.storage.get('token').then((value) => {
console.log('doorToken: ' + JSON.parse(value).AuthToken); //printing value in console
let token= JSON.parse(value).AuthToken;
this.userProvider.LockOpen(JSON.parse(value).AuthToken, this.id).then(data => {
console.log('list: ' + JSON.stringify(data))
this.accessDoor = data;
this.id= this.accessDoor.ControllerId
console.log('id' + this.id);
});
});
}