-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
facebook.ts
42 lines (36 loc) · 1.05 KB
/
facebook.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
/**
* @copyright 2021-present Kriasoft (https://git.io/JOevo)
*/
import type { ModuleOptions } from "simple-oauth2";
import { AuthorizationCode as Base } from "simple-oauth2";
export const version = "v10.0";
export type AuthorizationCodeOptions = {
/**
* Facebook application ID.
* @default process.env.FACEBOOK_APP_ID
*/
id?: string;
/**
* Facebook application secret.
* @default process.env.FACEBOOK_APP_SECRET
*/
secret?: string;
options?: ModuleOptions<"client_id">["options"];
};
export class AuthorizationCode extends Base {
constructor(options: AuthorizationCodeOptions = {}) {
super({
client: {
id: options.id ?? (process.env.FACEBOOK_APP_ID as string),
secret: options.secret ?? (process.env.FACEBOOK_APP_SECRET as string),
},
auth: {
tokenHost: "https://graph.facebook.com",
tokenPath: `/${version}/oauth/access_token`,
authorizeHost: "https://www.facebook.com",
authorizePath: `/${version}/dialog/oauth`,
},
options: options.options,
});
}
}