title: How to store authentication bearer token in browser cookie using AngularJS
body: <p>I have created a bearer token using ASP.net Identity. In AngularJS I wrote this function to get authorized data.</p>
  
  <pre><code>$scope.GetAuthorizeData = function () {
    $http({
      method: 'GET',
      url: "/api/Values",
      headers: { 'authorization': 'bearer &lt;myTokenId&gt;' },
    }).success(function (data) {
      alert("Authorized :D");
      $scope.values = data;
    }).error(function () {
      alert("Failed :(");
    });
  };
  </code></pre>
  
  <p>So <strong>I want to store this token into Browser cookies</strong>. If this token is present there , then take the token and get the data from IIS server Otherwise redirect to login page to login to get a new token.</p>
  
  <p>Similarly, if user click onto log out button, it should remove the token from browser cookie.</p>
  
  <p><strong>How to do this ? It it possible ? Is it proper way to authenticate and authorize a user ? What to do if there are multiple users token ?</strong></p>