From 36ee07bd009efed4d7c11829429298083eceeac4 Mon Sep 17 00:00:00 2001 From: Hyunyoung Cho Date: Tue, 11 Sep 2018 06:48:37 +0900 Subject: [PATCH] Fix: missing passReqToCallback for passport-kakao (#28722) * Fix: missing passReqToCallback property for passport-kakao * Fix: only major.minor version allowed --- types/passport-kakao/index.d.ts | 10 +++++++++- types/passport-kakao/passport-kakao-tests.ts | 7 ++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/types/passport-kakao/index.d.ts b/types/passport-kakao/index.d.ts index b005b45d98..dbb4c2f07b 100644 --- a/types/passport-kakao/index.d.ts +++ b/types/passport-kakao/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for passport-kakao 0.1 +// Type definitions for passport-kakao 0.2 // Project: https://github.com/rotoshine/passport-kakao // Definitions by: Park9eon +// ZeroCho // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -24,11 +25,18 @@ export interface StrategyOption { customHeaders?: string; } +export interface StrategyOptionWithRequest extends StrategyOption { + passReqToCallback: boolean; +} + export type VerifyFunction = (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void) => void; +export type VerifyFunctionWithRequest = + (req: express.Request, accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void) => void; export class Strategy extends passport.Strategy { constructor(options: StrategyOption, verify: VerifyFunction); + constructor(options: StrategyOptionWithRequest, verify: VerifyFunctionWithRequest); authenticate(req: express.Request, options?: any): void; userProfile: (accessToken: string, done: (error: any, user?: any) => void) => void; diff --git a/types/passport-kakao/passport-kakao-tests.ts b/types/passport-kakao/passport-kakao-tests.ts index 595404cc5b..5f104f6c41 100644 --- a/types/passport-kakao/passport-kakao-tests.ts +++ b/types/passport-kakao/passport-kakao-tests.ts @@ -1,10 +1,11 @@ -import {Strategy as KakaoStrategy } from 'passport-kakao'; +import { Strategy as KakaoStrategy } from 'passport-kakao'; new KakaoStrategy({ clientID: 'client', clientSecret: 'clientSecret', - callbackURL: 'callbackUrl' + callbackURL: 'callbackUrl', }, (accessToken: string, refreshToken: string, profile: any, done: any) => { // signUp or signIn - }); + }, +);