Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/koajs/cross-cookies

Easily set cookies across subdomains
https://github.com/koajs/cross-cookies

Last synced: 27 days ago
JSON representation

Easily set cookies across subdomains

Awesome Lists containing this project

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]>