Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koajs/cross-cookies
Easily set cookies across subdomains
https://github.com/koajs/cross-cookies
Last synced: 2 months ago
JSON representation
Easily set cookies across subdomains
- Host: GitHub
- URL: https://github.com/koajs/cross-cookies
- Owner: koajs
- Created: 2015-07-31T05:25:11.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-26T20:51:31.000Z (almost 9 years ago)
- Last Synced: 2024-04-14T13:08:39.354Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 13
- Watchers: 8
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
- awesome-koa - cross-cookies - Easily set cookies across subdomains (Middleware)
README
# cross-cookies
Easily set cross subdomain cookies
## Installation
```
npm install cross-cookies
```## Usage
```js
// Setup cors `withCredentials`
app.use(require('koa-cors')({
origin: process.env.OTHER_SUBDOMAIN_URL,
credentials: true
}))app.use(require('cross-cookies')())
app.keys = ['zippity', 'doo', 'da']app.use(function *(next) {
this.crosscookies('token', 'some token');
})
```> Note: If you're going to set cookies across subdomains, you're going to need
to be able to make requests across subdomains, so you'll need to set up CORS.## License
(The MIT License)
Copyright (c) 2015 Matthew Mueller <[email protected]>