3

Does anyone know what may be preventing my token from being read by my API, Yes, Cors is enabled on my api, and I can call my end point from Fiddler(and see my authenticated user successfully like that). I have made sure that IIS accepts all verbs, and I am passing my auth token like so:

public Post = (endpoint: string, filter?: Type): Observable<Type[]> => {
    let headers = new Headers();
    headers.append("Authorization",'Bearer ' + this._cookieService.get('access_token'));
    headers.append("Content-Type","application/json");
    let options = new RequestOptions({ headers: headers });
    debugger;

      return this._http.post(Config.API + endpoint, options)
        .map((response: Response) => <Type>response.json())
        .catch(this.handleError);
  }

I am sending: enter image description here

However, on my server I get: enter image description here

Hitting the endpoint with fiddler and an auth token like so: Authorization => Bearer WiZJQv9TJHEixcdI4FS94PUWsQlwkslKBXKq_fBbeup66XA0OuhG9jkyHbJ1ONKykxEtNHf-WpETb5r4Vj_42GvBu2SPSM_rWhs_svwzBesa9ozpkgRBVm_BvNShiUDGlD4T5-X2s4PFC1ssxQ4a74qb8ZfASG8nd8OS1hGxwaYC5e0uBZWxPvHqGEicJVOJ6qd-ANb56wkwavCnt1PUr4BK0X6z1UWCAhSf8iZGC_w8wmDr7sVQqEkxdoRQPH8_PFVNivbq9qPO1kLDMrsDTchohLR1spET9IxHvWgrTwV8D5tNysj_ZH4vxp_yXjYoCyOvzvC-nU4poX8NUPIh2Z-3MgxjbTMGA35sn3TMZo1XvpFcdChXSQFHig8hzHqXjfj_K8czM3xaIgjx-RgzLVcl_A-i-7vGFY9TcmLBqC8-mQ4eTOqgW6j4cm9N5mfk6VmIlCOAWJu2k1cixwZHxwOsvdkbBQJP8bbnjUeYJ1k results in:enter image description here

I have been at this for hours, Would someone please give me a pointer? Thanks, -Kevin

2
  • what is the expected header from the service side? Commented May 13, 2017 at 1:15
  • let me grab a pic of it from when i use fiddler Commented May 13, 2017 at 1:16

1 Answer 1

1

I found the issue, I omitted the body of the post. Here is a corrected post:

return this._http.post(Config.API + endpoint, filter, options)
        .map((response: Response) => <Type>response.json())
        .catch(this.handleError);
Sign up to request clarification or add additional context in comments.

2 Comments

Hi I having same problem as you have, can you kindly put me right direction. here is my question stackoverflow.com/questions/48376798/…
do I have to wrap user identity separate in addition to token or just token, at the movement I cannot these details other then authentication token at web api ???

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.