# passport-nekocas

> nekocas sdk for passport

Latest version **1.0.5** (published 2020-12-25) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install passport-nekocas
pnpm add passport-nekocas
yarn add passport-nekocas
bun add passport-nekocas
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2020-12-25 |
| First published | 2020-12-24 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | mugai |
| Maintainers | mugai |

## Links

- npm: https://www.npmjs.com/package/passport-nekocas
- Repository: https://github.com/nekoWheel/passport-nekocas
- Homepage: https://github.com/nekoWheel/passport-nekocas#readme
- Issues: https://github.com/nekoWheel/passport-nekocas/issues
- npm.io page: https://npm.io/package/passport-nekocas

## Dependencies (3)

- [url](https://npm.io/package/url.md) ^0.11.0
- [nekocas](https://npm.io/package/nekocas.md) ^1.0.6
- [passport-strategy](https://npm.io/package/passport-strategy.md) ^1.0.0

## Recent versions

- 1.0.5 (latest) — 2020-12-25
- 1.0.4 — 2020-12-24
- 1.0.3 — 2020-12-24
- 1.0.2 — 2020-12-24
- 1.0.1 — 2020-12-24
- 1.0.0 — 2020-12-24

## README

# passport-nekocas
[Passport](http://passportjs.org/) strategy for authenticating with [NekoCAS](https://github.com/NekoWheel/NekoCAS)

## Install
```bash
$ npm install passport-nekocas
```

## Usage
Configure Strategy:
```javascript
const NekocasStrategy = require('passport-nekocas').Strategy

passport.use(new NekocasStrategy({
  serviceBaseURL: 'http://localhost',
  secret: 'vNOZpKdqnUYcztBjUhvvPLpeYCIIBVev',
  domain: 'https://cas.n3ko.co'
}, function (user, done) {
  models.User.findOrCreate({
    where: {
      email: user.email
    }
  }).spread(function (user) {
    if (!user) return done(null, false)
    return done(null, user)
  }).catch(function (err) {
    return done(err)
  })
}))
```
Authenticate Requests:
```javascript
passport.authenticate('nekocas', {
    successReturnToOrRedirect: '/',
    failureRedirect: '/',
    failureFlash: 'Failed to login.'
})(req, res, next)
```

---
_Source: https://npm.io/package/passport-nekocas · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
