I have a sharepoint list(User). I am able to get these data with simple http request in browser.here is the out put of request:
all items retrieving as you see below and I am trying to achieve this in typescript service here is my code piece;
getUsers() : Observable<Users[]> {
var headers = new Headers();
headers.append('accept', 'application/json;odata=verbose');
return this.http_.get("https://yeneryilmaz1-3200ef41d84877.sharepoint.com/Sharepoint-TS-Angular2/_api/web/lists/getByTitle('User')/items",{headers})
.map((res:Response) => res.json())
.catch((error:any) => Observable.throw(error.json().error || 'Server error'));
}
but it always throws exception.. how can I get list items via http request and also I know i need to add access token of from sharepoint account how can I add them to headers ?
EDITED: response of the server for this request in browser console: "GET https://yeneryilmaz1-***.sharepoint.com/Sharepoint-TS-Angular2/_api/web/lists/getByTitle('User')/items 403 (Forbidden)"
so it seems authentication issue i encounter, so.. how can I embed access tokens to this request