@types/feathersjs__authentication-oauth1
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

Installation

npm install --save @types/feathersjs__authentication-oauth1

Summary

This package contains type definitions for @feathersjs/authentication-oauth1 (https://feathersjs.com).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/feathersjs__authentication-oauth1.

index.d.ts

import { Application, Paginated } from "@feathersjs/feathers";
import { Request } from "express";
// eslint-disable-next-line @definitelytyped/no-self-import
import * as self from "@feathersjs/authentication-oauth1";

declare const feathersAuthenticationOAuth1:
    & ((options?: FeathersAuthenticationOAuth1Options) => () => void)
    & typeof self;
export default feathersAuthenticationOAuth1;

export interface FeathersAuthenticationOAuth1Options {
    /**
     * The field to look up the entity by when logging in with the provider. Defaults to '<provider>Id' (ie. 'twitterId').
     */
    idField: string;
    /**
     * The route to register the middleware
     */
    path: string;
    /**
     * The route to register the callback handler
     */
    callbackPath: string;
    /**
     * hostname[:port]/auth/<provider>/callback',
     */
    callbackURL: string;
    /**
     * the entity that you are looking up
     */
    entity: string;
    /**
     * the service to look up the entity
     */
    service: string;
    /**
     * whether the request object should be passed to `verify`
     */
    passReqToCallback: boolean;
    /**
     * whether to use sessions,
     */
    session: boolean;
    /**
     * Express middleware for handling the oauth callback. Defaults to the built in middleware. todo: needs a proper type
     */
    handler: any;
    /**
     * The response formatter. Defaults the the built in feathers-rest formatter, which returns JSON. todo: needs a proper type
     */
    formatter: any;
    /**
     * A Verifier class. Defaults to the built-in one but can be a custom one. See below for details.
     */
    Verifier: OAuth1Verifier;
}

export class OAuth1Verifier {
    constructor(app: Application, options: any);

    _updateEntity(entity: any, data: { profile: any; accessToken: string; refreshToken: string }): Promise<any>; // updates an existing entity
    _createEntity(data: { profile: any; accessToken: string; refreshToken: string }): Promise<any>; // creates an entity if they didn't exist already
    _normalizeResult<T>(results: T[] | Paginated<T>): Promise<T>; // normalizes result from service to account for pagination
    verify(
        req: Request,
        accessToken: string,
        refreshToken: string,
        profile: any,
        done: (err: Error | null, user: object, info: object) => void,
    ): void;
}

Additional Details

Credits

These definitions were written by Jan Lohage.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/feathersjs__authentication-oauth1

Weekly Downloads

0

Version

1.0.10

License

MIT

Unpacked Size

7.68 kB

Total Files

5

Last publish

Collaborators

  • types