Fix: missing passReqToCallback for passport-kakao (#28722)

* Fix: missing passReqToCallback property for passport-kakao

* Fix: only major.minor version allowed
This commit is contained in:
Hyunyoung Cho
2018-09-11 06:48:37 +09:00
committed by Ryan Cavanaugh
parent 37b5c6a8e4
commit 36ee07bd00
2 changed files with 13 additions and 4 deletions

View File

@@ -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 <https://github.com/Park9eon>
// ZeroCho <https://github.com/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;

View File

@@ -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
});
},
);