-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoken.ts
More file actions
29 lines (25 loc) · 748 Bytes
/
Copy pathtoken.ts
File metadata and controls
29 lines (25 loc) · 748 Bytes
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
import { Command, flags } from "@oclif/command";
import axios from "axios";
export default class Token extends Command {
static description = "Generates facebook upload token";
static flags = {
help: flags.help({ char: "h" }),
};
static args = [
{ name: "id", description: "App id", required: true },
{
name: "secret",
description: "App secret",
required: true,
},
];
async run() {
const { args } = this.parse(Token);
const { id, secret } = args;
const result = await axios.get(
`https://graph.facebook.com/oauth/access_token?client_id=${id}&client_secret=${secret}&grant_type=client_credentials`
);
const { access_token } = result.data;
this.log(access_token);
}
}