Fix refresh token code to actually refresh the token
Use angular modules rather than global variable