Issue with refresh token in Laravel 5.1 / AngularJS app


I am having issue with refreshing a JWT Token in my Ionic / Angularj JS app. The restful api when tested in postman successfully returns a refreshed token and I can use it in postman to make other rest calls. However, when I try storing the refreshed token on my localStorage by over riding the existing token.

I have looked at laravel / angularjs JWT token refresh for clues but the issue I have is not with Laravel generating the token. It is the Ionic / Angular.js not being able to store the refreshed token. Can someone please advise?

// Laravel token refresh call
public function myToken()
$token = JWTAuth::getToken();
$refreshtoken = JWTAuth::refresh($token);
$token = $refreshtoken;
return response()->json(compact(‘token’));

// Angular.JS token call
if($localStorage.hasOwnProperty(“token”) === true) {
var mytoken = $localStorage.token;