Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AngularJS 2, problem to receive the Fitbit custom headers

Dear All,

 

I’m trying to get the "Fitbit-Rate-Limit-Remaining" and "Fitbit-Rate-Limit-Limit" headers, from the response of the Angular 2 REST. Unfortunatelly I can see only these headers: "Content-Type", "Cache-Control" and "Content-Language".

 

For testing purpose, I created a custom header on a test server. And was been received by the Angular 2 REST, but only if the header "Access-Control-Expose-Headers" was set to the custom header.

Example: "Access-Control-Expose-Headers: Fitbit-Rate-Limit-Limit, Fitbit-Rate-Limit-Remaining, Fitbit-Rate-Limit-Reset"

 

Is the "Access-Control-Expose-Headers" header set on your server API?

 

Thank you for the help!

Best Answer
0 Votes
4 REPLIES 4

@Mark81 Maybe it's an issue with Angular 2 REST? Because I can see the rate limit headers in the response when I use curl.

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

It seems that the browser receive all the headers, but it won't expose all the headers to JavaScript. The extra headers to expose are to be declared on the "Access-Control-Expose-Headers" header on server side. Information: https://www.w3.org/TR/cors/#access-control-expose-headers-response-header

 

I tested this behaviour on a test server. Please can a moderator ask the developer team to check? Thanks a lot! 🙂

Best Answer
0 Votes

Any news? Smiley Indifferent

Best Answer
0 Votes

I found what was the issue: if the callback URL isn't SSL, on JavaScript the headers aren't received. 🙂

Best Answer
0 Votes