mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
added passport-beam
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/// <reference path="./passport-beam.d.ts" />
|
||||
|
||||
/**
|
||||
* Created by AtlasDev on 4/10/2016.
|
||||
* Based on typings from passport-facebook by jcabresos.
|
||||
*/
|
||||
import passport = require('passport');
|
||||
import beam = require('passport-beam');
|
||||
|
||||
var User = {
|
||||
findOrCreate(id:string, provider:string, callback:(err:any, user:any) => void): void {
|
||||
callback(null, { username: 'Dany' });
|
||||
}
|
||||
}
|
||||
|
||||
passport.use(new beam.Strategy({
|
||||
clientID: BEAM_CLIENT_ID,
|
||||
clientSecret: BEAM_CLIENT_SECRET,
|
||||
callbackURL: "http://127.0.0.1:3000/auth/beam/callback"
|
||||
},
|
||||
function(accessToken:string, refreshToken:string, profile:beam.Profile, done:(error:any, user?:any) => void) {
|
||||
User.findOrCreate(profile.id, profile.provider, function(err, user) {
|
||||
if (err) { return done(err); }
|
||||
done(null, user);
|
||||
});
|
||||
})
|
||||
);
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
// Type definitions for passport-beam 1.0.4
|
||||
// Project: https://github.com/alfw/passport-beam
|
||||
// Definitions by: AtlasDev <https://github.com/AtlasDev>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../passport/passport.d.ts"/>
|
||||
|
||||
declare module "passport-beam" {
|
||||
|
||||
import * as passport from 'passport';
|
||||
import * as express from 'express';
|
||||
|
||||
interface Profile extends passport.Profile {
|
||||
gender: string;
|
||||
profileUrl: string;
|
||||
id: number
|
||||
username: string;
|
||||
provider: string;
|
||||
email: string;
|
||||
|
||||
_raw: string;
|
||||
_json: any;
|
||||
}
|
||||
|
||||
interface IStrategyOption {
|
||||
clientID: string;
|
||||
clientSecret: string;
|
||||
callbackURL: string;
|
||||
}
|
||||
|
||||
class Strategy implements passport.Strategy {
|
||||
constructor(options: IStrategyOption, verify: (accessToken: string, refreshToken: string, profile: any, done: (error: any, user?: any) => void) => void);
|
||||
name: string;
|
||||
authenticate: (req: express.Request, options?: Object) => void;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user