# @types/koa-passport

> TypeScript definitions for koa-passport

Latest version **6.0.3** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/koa-passport
pnpm add @types/koa-passport
yarn add @types/koa-passport
bun add @types/koa-passport
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 6.0.3 |
| Published | 2023-11-07 |
| First published | 2016-10-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51446 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/koa-passport
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-passport
- npm.io page: https://npm.io/package/@types/koa-passport

## Dependencies (2)

- [@types/koa](https://npm.io/package/@types/koa.md) *
- [@types/passport](https://npm.io/package/@types/passport.md) *

## Recent versions

- 6.0.3 (latest) — 2023-11-07
- 6.0.0 (ts4.3) — 2023-03-27
- 4.0.3 (ts3.7) — 2021-11-14
- 4.0.2 (ts2.3) — 2018-09-05
- 2.0.4 (ts2.0) — 2017-02-21
- 6.0.2 — 2023-10-18
- 6.0.1 — 2023-09-14
- 4.0.1 — 2017-12-28
- 4.0.0 — 2017-12-15
- 2.0.5 — 2017-11-09
- 2.0.3 — 2016-12-19
- 2.0.2 — 2016-11-04
- 2.0.1 — 2016-10-26

## README

# Installation
> `npm install --save @types/koa-passport`

# Summary
This package contains type definitions for koa-passport (https://github.com/rkusa/koa-passport).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-passport.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-passport/index.d.ts)
````ts
/* =================== USAGE ===================

    import * as passport from 'koa-passport';
    app.use(passport.initialize());
    app.use(passport.session());

 =============================================== */

import { Middleware } from "koa";

import * as passport from "passport";

declare module "koa" {
    interface ExtendableContext {
        login(user: any, options?: any): Promise<void>;
        logIn: ExtendableContext["login"];

        logout(): Promise<void>;
        logOut: ExtendableContext["logout"];

        isAuthenticated(): boolean;
        isUnauthenticated(): boolean;
    }
}

declare namespace KoaPassport {
    class KoaPassport {
        use(strategy: passport.Strategy): this;
        use(name: string, strategy: passport.Strategy): this;
        unuse(name: string): this;
        framework(fw: passport.Framework): this;
        initialize(options?: { userProperty: string }): Middleware;
        session(options?: { pauseStream: boolean }): Middleware;

        authenticate(strategy: string | string[], callback?: (...args: any[]) => any): Middleware;
        authenticate(
            strategy: string | string[],
            options: passport.AuthenticateOptions | object,
            callback?: (...args: any[]) => any,
        ): Middleware;
        authorize(strategy: string | string[], callback?: (...args: any[]) => any): Middleware;
        authorize(strategy: string | string[], options: any, callback?: (...args: any[]) => any): Middleware;

        serializeUser: passport.Authenticator["serializeUser"];
        deserializeUser: passport.Authenticator["deserializeUser"];
        transformAuthInfo: passport.Authenticator["transformAuthInfo"];
    }

    interface Static extends KoaPassport {
        KoaPassport: typeof KoaPassport;
        Passport: typeof passport.Passport;
        Authenticator: Static["Passport"];
    }
}

declare const koaPassport: KoaPassport.Static;

export = koaPassport;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 09:09:38 GMT
 * Dependencies: [@types/koa](https://npmjs.com/package/@types/koa), [@types/passport](https://npmjs.com/package/@types/passport)

# Credits
These definitions were written by [horiuchi](https://github.com/horiuchi), [Tomek Łaziuk](https://github.com/tlaziuk), and [Tümay Çeber](https://github.com/brendtumi).

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