diff --git a/types/passport-facebook/index.d.ts b/types/passport-facebook/index.d.ts index 320a2169ba..cd35cbe0c8 100644 --- a/types/passport-facebook/index.d.ts +++ b/types/passport-facebook/index.d.ts @@ -11,9 +11,9 @@ import passport = require('passport'); import express = require('express'); interface Profile extends passport.Profile { - gender: string; - profileUrl: string; - username: string; + gender?: string; + profileUrl?: string; + username?: string; _raw: string; _json: any; @@ -33,15 +33,8 @@ interface IStrategyOption { profileFields?: string[]; } -interface IStrategyOptionWithRequest { - clientID: string; - clientSecret: string; - callbackURL: string; - - scopeSeparator?: string; - enableProof?: boolean; - profileFields?: string[]; - passReqToCallback: boolean; +interface IStrategyOptionWithRequest extends IStrategyOption { + passReqToCallback: true; } interface VerifyFunction { diff --git a/types/passport-google-oauth/index.d.ts b/types/passport-google-oauth/index.d.ts index 0dd283001b..50930a45ad 100644 --- a/types/passport-google-oauth/index.d.ts +++ b/types/passport-google-oauth/index.d.ts @@ -62,9 +62,16 @@ interface IOAuth2StrategyOption { openIDRealm?: string; } +interface IOAuth2StrategyOptionWithRequest extends IOAuth2StrategyOption { + passReqToCallback: true; +} + declare class OAuth2Strategy implements passport.Strategy { constructor(options: IOAuth2StrategyOption, verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void); + constructor(options: IOAuth2StrategyOptionWithRequest, + verify: (req: express.Request, accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void); + name: string; authenticate: (req: express.Request, options?: Object) => void; } diff --git a/types/passport-local/index.d.ts b/types/passport-local/index.d.ts index f5047a4a29..4a87b132d8 100644 --- a/types/passport-local/index.d.ts +++ b/types/passport-local/index.d.ts @@ -13,13 +13,13 @@ import express = require('express'); interface IStrategyOptions { usernameField?: string; passwordField?: string; - passReqToCallback?: boolean; + passReqToCallback?: false; } interface IStrategyOptionsWithRequest { usernameField?: string; passwordField?: string; - passReqToCallback: boolean; + passReqToCallback: true; } interface IVerifyOptions { diff --git a/types/passport-twitter/index.d.ts b/types/passport-twitter/index.d.ts index 387fa7ab44..1ee2d4482f 100644 --- a/types/passport-twitter/index.d.ts +++ b/types/passport-twitter/index.d.ts @@ -24,7 +24,6 @@ interface IStrategyOption { consumerSecret: string; callbackURL: string; - passReqToCallback?: true; includeEmail?: true; reguestTokenURL?: string; @@ -36,9 +35,16 @@ interface IStrategyOption { skipExtendedUserProfile?: boolean; } +interface IStrategyOptionWithRequest extends IStrategyOption { + passReqToCallback: true; +} + declare class Strategy implements passport.Strategy { constructor(options: IStrategyOption, verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void); + constructor(options: IStrategyOptionWithRequest, + verify: (req: express.Request, accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void); + name: string; authenticate: (req: express.Request, options?: Object) => void; }