Add package [passport-kakao & passport-naver] (#22798)

* Add package [passport-kakao & passport-naver]

* Fixed types/tsconfig.json [passport-kakao & passport-naver]
This commit is contained in:
Park Geon
2018-01-13 03:03:29 +09:00
committed by Ryan Cavanaugh
parent 5be99ed666
commit c76270a2d2
8 changed files with 153 additions and 0 deletions

35
types/passport-kakao/index.d.ts vendored Normal file
View File

@@ -0,0 +1,35 @@
// Type definitions for passport-kakao 0.1
// Project: https://github.com/rotoshine/passport-kakao
// Definitions by: Park9eon <https://github.com/Park9eon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import passport = require("passport");
import express = require("express");
export interface Profile extends passport.Profile {
id: string;
provider: string;
_raw: string;
_json: any;
}
export interface StrategyOption {
clientID: string;
clientSecret: string;
callbackURL: string;
scopeSeparator?: string;
customHeaders?: string;
}
export type VerifyFunction =
(accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void) => void;
export class Strategy implements passport.Strategy {
constructor(options: StrategyOption, verify: VerifyFunction);
authenticate: (req: express.Request, options?: any) => void;
userProfile: (accessToken: string, done: (error: any, user?: any) => void) => void;
}

View File

@@ -0,0 +1,10 @@
import {Strategy as KakaoStrategy } from 'passport-kakao';
new KakaoStrategy({
clientID: 'client',
clientSecret: 'clientSecret',
callbackURL: 'callbackUrl'
},
(accessToken: string, refreshToken: string, profile: any, done: any) => {
// signUp or signIn
});

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"passport-kakao-tests.ts"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}

46
types/passport-naver/index.d.ts vendored Normal file
View File

@@ -0,0 +1,46 @@
// Type definitions for passport-naver 0.1
// Project: https://github.com/naver/passport-naver
// Definitions by: Park9eon <https://github.com/Park9eon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import passport = require("passport");
import express = require("express");
export interface Profile extends passport.Profile {
id: string;
provider: string;
_json: {
email: string,
nickname: string,
profile_image: string,
age: number,
birthday: any
id: string
};
}
export interface StrategyOption {
clientID: string;
clientSecret: string;
callbackURL: string;
svcType?: number;
authType?: string;
authorizationURL?: string;
tokenURL?: string;
profileURL?: string;
}
export type VerifyFunction =
(accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void) => void;
export class Strategy implements passport.Strategy {
constructor(options: StrategyOption, verify: VerifyFunction);
authenticate: (req: express.Request, options?: any) => void;
authorizationParams: (options: any) => any;
userProfile: (accessToken: string, done: (error: any, user?: any) => void) => void;
}

View File

@@ -0,0 +1,10 @@
import {Strategy as NaverStrategy } from 'passport-naver';
new NaverStrategy({
clientID: 'client',
clientSecret: 'clientSecret',
callbackURL: 'callbackUrl'
},
(accessToken: string, refreshToken: string, profile: any, done: any) => {
// signUp or signIn
});

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"passport-naver-tests.ts"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}