-
Notifications
You must be signed in to change notification settings - Fork 0
/
strategy.d.ts
54 lines (49 loc) · 1.61 KB
/
strategy.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import OAuth1Strategy = require('passport-oauth1');
/**
* The Twitter authentication strategy authenticates requests by delegating to
* Twitter using the OAuth protocol.
*
* Applications must supply a `verify` callback which accepts a `token`,
* `tokenSecret` and service-specific `profile`, and then calls the `cb`
* callback supplying a `user`, which should be set to `false` if the
* credentials are not valid. If an exception occured, `err` should be set.
*
* Examples:
*
* passport.use(new TwitterStrategy({
* consumerKey: '123-456-789',
* consumerSecret: 'shhh-its-a-secret'
* callbackURL: 'https://www.example.net/auth/twitter/callback'
* },
* function(token, tokenSecret, profile, cb) {
* User.findOrCreate(..., function (err, user) {
* cb(err, user);
* });
* }
* ));
*/
declare class TwitterStrategy extends OAuth1Strategy<TwitterStrategy.Profile> {
name: 'twitter';
constructor (options: TwitterStrategy.Options, verify: OAuth1Strategy.VerifyFunction<TwitterStrategy.Profile>);
}
declare namespace TwitterStrategy {
export interface Options extends OAuth1Strategy.OAuth1Options {
userProfileURL?: string;
skipExtendedUserProfile?: boolean;
includeEmail?: boolean;
includeStatus?: boolean;
includeEntities?: boolean;
}
export interface Profile {
provider: 'twitter';
_raw: string;
_json: any;
_accessLevel: string;
id: string;
username: string;
displayName: string;
emails?: Array<{ value: string }>;
photos: Array<{ value: string }>;
}
}
export = TwitterStrategy;