Securely store user authentication information

Hi All,

I’m new to Ionic and i wanted to check about securing the authentication data. I have this method to login to the web service, and everytime i wanted to access the web service, i’d need to put my email and password in the header. Is there any way to securely store this information? Thanks.

login(email, password): Promise {
let user: User;
this.authString = 'Basic ’ + btoa(email + ‘:’ + password);


getEntriesData(): Promise<Entry[]> {
console.log("User data: " + this.user);
if (this.user && this.authString && this.authString!=’’) {
return this.http.get(this.getEntriesUrl, {headers: this.getHeaders()})
.then(response => response.json() as Entry[])
else {
return null;

private getHeaders(){
let headers = new Headers();
headers.append(‘Accept’, ‘application/json’);
headers.append(‘Authorization’, this.authString);
return headers;

It depends on who you’re trying to secure it from. If the answer is “the device owner”, that’s not really possible. I would recommend looking into JWT here.

ok, thanks for the recommendation.