mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 15:00:26 +00:00
fix passport google oauth type (#9653)
This commit is contained in:
committed by
Masahiro Wakame
parent
1b272795b6
commit
2373d3f801
@@ -18,10 +18,11 @@ passport.use(new google.OAuthStrategy({
|
||||
consumerSecret: process.env.GOOGLE_CONSUMER_SECRET,
|
||||
callbackURL: process.env.PASSPORT_GOOGLE_CALLBACK_URL
|
||||
},
|
||||
function(accessToken:string, refreshToken:string, profile:google.Profile, done:(error:any, user?:any) => void) {
|
||||
function(accessToken:string, refreshToken:string, profile:google.Profile, done:(error:any, user?:any, msg?: google.VerifyOptions) => void) {
|
||||
User.findOrCreate(profile.id, profile.provider, function(err, user) {
|
||||
if (err) { return done(err); }
|
||||
done(null, user);
|
||||
else if(!user) return done(null, false, {message: 'not found user'});
|
||||
return done(null, user);
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
+9
-1
@@ -28,9 +28,17 @@ declare module 'passport-google-oauth' {
|
||||
sessionKey?: string;
|
||||
}
|
||||
|
||||
interface VerifyOptions {
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface VerifyFunction {
|
||||
(error: any, user?: any, msg?: VerifyOptions): void;
|
||||
}
|
||||
|
||||
class OAuthStrategy implements passport.Strategy {
|
||||
constructor(options: IOAuthStrategyOption,
|
||||
verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void);
|
||||
verify: (accessToken: string, refreshToken: string, profile: Profile, done: VerifyFunction) => void);
|
||||
name: string;
|
||||
authenticate: (req: express.Request, options?: Object) => void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user