title: React axios storing token in local storage
body: <p>I have the following response coming back from a React Axios post request...</p>
  
  <pre><code>{
      "Id": 1,
      "UserName": "***",
      "Password": null,
      "Email": "***",
      "FirstName": "Steven",
      "Surname": "Collins",
      "CompanyName": "***",
      "OrisecAccountNumber": "***",
      "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6InN0ZXZlLmNvbGxpbnNAb3Jpc2VjLmNvLnVrIiwicm9sZSI6WyJPcmlzZWNBZG1pbiIsIkluc3RhbGxlckFkbWluIl0sIm5iZiI6MTU3MzA2OTg2NiwiZXhwIjoxNTczMDcwNzU2LCJpYXQiOjE1NzMwNjk4NjYsImlzcyI6Ik9yaXNlYyJ9.UgUbLpM0Zs0KYT4XRy20Tkfc9SLgT-8EhhZziahper8",
      "TokenCreatedOnUtc": "0001-01-01T00:00:00",
      "TokenExpiresInMinutes": 15,
      "Roles": [
          "OrisecAdmin",
          "InstallerAdmin"
      ]
  }
  </code></pre>
  
  <p>The POST request is as follows...</p>
  
  <pre><code>instancePost.post('/identity/account/login', {
      username: '***',
      password: '***'
  })
      .then(function (response) {
          localStorage.setToken('access_token', JSON.stringify(response.data));
          localStorage.setToken('refresh_token', JSON.stringify(response.data));
          console.log(response);
      })
      .catch(function (error) {
          console.log(error);
      });
  </code></pre>
  
  <p>}</p>
  
  <p>My local storage service is as follows...</p>
  
  <pre><code>// LocalStorageService.js
  const LocalStorageService = (function () {
      var _service;
      function _getService() {
          if (!_service) {
              _service = this;
              return _service
          }
          return _service
      }
      function _setToken(tokenObj) {
          localStorage.setItem('access_token', tokenObj.access_token);
          localStorage.setItem('refresh_token', tokenObj.refresh_token)
      }
      function _getAccessToken() {
          return localStorage.getItem('access_token');
      }
      function _getRefreshToken() {
          return localStorage.getItem('refresh_token');
      }
      function _clearToken() {
          localStorage.removeItem('access_token');
          localStorage.removeItem('refresh_token');
      }
      return {
          getService: _getService,
          setToken: _setToken,
          getAccessToken: _getAccessToken,
          getRefreshToken: _getRefreshToken,
          clearToken: _clearToken
      }
  })();
  export default LocalStorageService;
  </code></pre>
  
  <p>I have tested the POST request in Postman and it works ok.
  My question is how do I store the Token value in local storage.  Im currently doing this which stores the name but not the actual token.</p>
  
  <pre><code> localStorage.setToken('access_token', JSON.stringify(response.data));
              localStorage.setToken('refresh_token', JSON.stringify(response.data));
  </code></pre>
  
  <p>Thanks.</p>