-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
github.ts
40 lines (35 loc) · 1015 Bytes
/
github.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
/**
* @copyright 2021-present Kriasoft (https://git.io/JOevo)
*/
import type { ModuleOptions } from "simple-oauth2";
import { AuthorizationCode as Base } from "simple-oauth2";
export type AuthorizationCodeOptions = {
/**
* GitHub client ID.
* @default process.env.GITHUB_CLIENT_ID
*/
id?: string;
/**
* GitHub client secret.
* @default process.env.GITHUB_CLIENT_SECRET
*/
secret?: string;
options?: ModuleOptions<"client_id">["options"];
};
export class AuthorizationCode extends Base {
constructor(options: AuthorizationCodeOptions = {}) {
super({
client: {
id: options.id ?? (process.env.GITHUB_CLIENT_ID as string),
secret: options.secret ?? (process.env.GITHUB_CLIENT_SECRET as string),
},
auth: {
tokenHost: "https://github.com",
tokenPath: "/login/oauth/access_token",
authorizeHost: "https://github.com",
authorizePath: "/login/oauth/authorize",
},
options: options.options,
});
}
}