mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Typings for passport-google-oauth2 @ 0.1.6 (#17763)
* Add typings for passport-google-oauth2 : 0.1.6 * Correct passport-google-oauth2 build errors * Define typescript version in passport-google-oauth2
This commit is contained in:
committed by
Ron Buckton
parent
135cf095e0
commit
e2a10612e5
+48
@@ -0,0 +1,48 @@
|
||||
// Type definitions for passport-google-oauth2 0.1
|
||||
// Project: https://github.com/mstade/passport-google-oauth2
|
||||
// Definitions by: Elliot Blackburn <https://github.com/bluehatbrit>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import {Request} from 'express';
|
||||
|
||||
export interface StrategyOptions {
|
||||
clientID: string;
|
||||
clientSecret: string;
|
||||
callbackURL: string;
|
||||
passReqToCallback?: true;
|
||||
scope?: string[];
|
||||
}
|
||||
|
||||
export interface StrategyOptionsWithRequest {
|
||||
clientID: string;
|
||||
clientSecret: string;
|
||||
callbackURL: string;
|
||||
passReqToCallback: true;
|
||||
scope?: string[];
|
||||
}
|
||||
|
||||
export interface VerifyOptions {
|
||||
message: string;
|
||||
}
|
||||
|
||||
export type VerifyCallback = (error: any, user?: any, options?: VerifyOptions) => void;
|
||||
|
||||
export type VerifyFunctionWithRequest = (
|
||||
req: Request,
|
||||
accessToken: string,
|
||||
refreshToken: string,
|
||||
profile: any,
|
||||
done: VerifyCallback
|
||||
) => void;
|
||||
|
||||
export type VerifyFunction = (accessToken: string, refreshToken: string, profile: any, done: VerifyCallback) => void;
|
||||
|
||||
export class Strategy implements Strategy {
|
||||
name: string;
|
||||
authenticate: (req: Request, options?: object) => void;
|
||||
|
||||
constructor(options: StrategyOptionsWithRequest, verify: VerifyFunctionWithRequest);
|
||||
constructor(options: StrategyOptions, verify: VerifyFunction);
|
||||
constructor(verify: VerifyFunction);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import * as express from 'express';
|
||||
import * as PassportGoogle from 'passport-google-oauth2';
|
||||
import { Strategy as GoogleStrategy } from 'passport-google-oauth2';
|
||||
|
||||
new GoogleStrategy({
|
||||
callbackURL: 'callbackurl',
|
||||
clientID: 'clientid',
|
||||
clientSecret: 'shhh',
|
||||
passReqToCallback: true,
|
||||
}, (
|
||||
req: express.Request,
|
||||
accessToken: string,
|
||||
refreshToken: string,
|
||||
profile: any,
|
||||
done: PassportGoogle.VerifyCallback) => {
|
||||
// Some registration / log in logic
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"passport-google-oauth2-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user