Skip to content

Commit

Permalink
add Profile common interface
Browse files Browse the repository at this point in the history
  • Loading branch information
horiuchi committed Jun 17, 2014
1 parent 14bea81 commit 39c44eb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
29 changes: 18 additions & 11 deletions passport-facebook/passport-facebook.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,25 @@ declare module 'passport-facebook' {
import passport = require('passport');
import express = require('express');

interface Profile {
id:string;
provider:string;
displayName:string;
name:{familyName:string; givenName:string; middleName:string};
profileUrl:string;
interface Profile extends passport.Profile {
gender: string;
profileUrl: string;
}

class Strategy implements passport.Strategy{
constructor(options:{clientID:string; clientSecret:string; callbackURL:string},
verify:(accessToken:string, refreshToken:string, profile:Profile, done:(error:any, user?:any) => void) => void);
interface IStrategyOption {
clientID: string;
clientSecret: string;
callbackURL: string;

scopeSeparator?: string;
enableProof?: boolean;
profileFields?: string[];
}

class Strategy implements passport.Strategy {
constructor(options: IStrategyOption,
verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void);
name: string;
authenticate:(req: express.Request, options?: Object) => void;
authenticate: (req: express.Request, options?: Object) => void;
}
}
}
19 changes: 19 additions & 0 deletions passport/passport.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ declare module 'passport' {
name?: string;
authenticate(req: express.Request, options?: Object): void;
}

interface Profile {
provider: string;
id: string;
displayName: string;
name? : {
familyName: string;
givenName: string;
middleName?: string;
};
emails?: {
value: string;
type?: string;
}[];
photos?: {
value: string;
}[];
}
}

declare module Express {
Expand All @@ -60,3 +78,4 @@ declare module Express {
isUnauthenticated(): boolean;
}
}

0 comments on commit 39c44eb

Please sign in to comment.