A full discussion of this issue can be found in the documentation for the setInterval() method, captioned The "this" Problem. About halfway down the page.
The jist is that it is the result of a change in the "this" variable. The function being passed into the setInterval() function is extracted from the class context and placed into the context of setInterval() (the window). So, it is undefined.
There are several solutions to this issue. The method proposed by toskv above is a fairly common approach.
Another solution is to use the bind() method.
constructor(private auth: AuthService) {
setInterval(this.auth.refreshToken.bind(this), 1000 * 60 * 10);
}
Reference material from this question, answer by Pointy.
Documentation for the bind() method.
A good article on javascript scope, which can still come back to bite you in typescript.
setInterval(() => this.auth.refreshToken(), 1000 * 60 * 10);
– Auburta