-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
33 lines (30 loc) · 870 Bytes
/
index.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
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
// Package imports
import fs from "fs"
import osuApiV2 from "osu-api-v2"
import path from "path"
const secretOAuthCredentialsPath = path.join(
__dirname,
"..",
"..",
"..",
"osu_api_v2_oauth_client_credentials.secret.json",
)
interface OAuthClientCredentialsSecret {
clientId: number
clientSecret: string
}
const secretOAuthCredentials = JSON.parse(
fs.readFileSync(secretOAuthCredentialsPath).toString(),
) as OAuthClientCredentialsSecret
console.log(secretOAuthCredentials)
osuApiV2.oauth
.clientCredentialsGrant(
secretOAuthCredentials.clientId,
secretOAuthCredentials.clientSecret,
)
.then((oauthAccessToken) => {
console.log(oauthAccessToken)
})
.catch(console.error)