lynndylanhurley/ng-token-auth — pull request #63 by m2omou (2014-10-30 15:58:27+00:00)
Title: set path to cookies

#55 After a long search, I finally found why I always got logged out when trying to access a restricted page.

It look like that `$cookieStore` is setting the cookie according to the path. So I get duplicated `auth_headers`, and the browser for some reason keep the old one.

![screen shot 2014-10-30 at 14 24 30](https://cloud.githubusercontent.com/assets/4422555/4846435/d592e4c6-604b-11e4-84cd-d9baaa688ec1.png)

So I tried to set a path to the cookies, but unfortunately in the [cookieStore documentation](https://docs.angularjs.org/api/ngCookies/service/$cookieStore) it's not possible, at least not yet.

So I have made some research to find an alternative way to do this. And find out this [thread](https://github.com/angular/angular.js/issues/1786).

So to resolve that issue I used that module:

https://github.com/ivpusic/angular-cookie

By replacing :
```javascript
$cookieStore.put(key, val)
```
with:
```javascript
ipCookie(key, val, { path: '/' })
```

And now everything works great, I'm not able to reproduce that issue anymore.