Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 229723

Authentication Ionic + Laravel

$
0
0

The easiest thing to do is to use this package https://github.com/auth0/angular2-jwt

It will automatically send your token and authorization header along with requests if you use this.authHttp.get and it has lots of helper functions like isTokenExpired()

If you want to do it like you have it, it would be something like this

let headers = new Headers({ 'Authorization': 'Bearer ' + window.localStorage.getItem('token') });
let options = new RequestOptions({ headers: headers });
return this.http.get(this.api+'causes', options).map( res => res.json());

I'm not sure what you are asking in the second question


Viewing all articles
Browse latest Browse all 229723

Trending Articles