mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-06 09:19:08 +00:00
added passport-facebook
This commit is contained in:
25
passport-facebook/passport-facebook-test.ts
Normal file
25
passport-facebook/passport-facebook-test.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Created by jcabresos on 4/19/2014.
|
||||
*/
|
||||
import passport = require('passport');
|
||||
import facebook = require('passport-facebook');
|
||||
|
||||
// just some test model
|
||||
var User = {
|
||||
findOrCreate(id:string, provider:string, callback:(err:any, user:any) => void): void {
|
||||
callback(null, {username:'james'});
|
||||
}
|
||||
}
|
||||
|
||||
passport.use(new facebook.Strategy({
|
||||
clientID: process.env.PASSPORT_FACEBOOK_CLIENT_ID,
|
||||
clientSecret: process.env.PASSPORT_FACEBOOK_CLIENT_SECRET,
|
||||
callbackURL: process.env.PASSPORT_FACEBOOK_CALLBACK_URL
|
||||
},
|
||||
function(accessToken:string, refreshToken:string, profile:facebook.Profile, done:(error:any, user?:any) => void) {
|
||||
User.findOrCreate(profile.id, profile.provider, function(err, user) {
|
||||
if (err) { return done(err); }
|
||||
done(null, user);
|
||||
});
|
||||
})
|
||||
);
|
||||
31
passport-facebook/passport-facebook.d.ts
vendored
Normal file
31
passport-facebook/passport-facebook.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// Type definitions for passport-facebook 1.0.3
|
||||
// Project: https://github.com/jaredhanson/passport-facebook
|
||||
// Definitions by: James Roland Cabresos <https://github.com/staticfunction>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../passport/passport.d.ts"/>
|
||||
|
||||
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 User<T> {
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
name: string;
|
||||
authenticate:(req: express.Request, options?: Object) => void;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user