add epic games connection

This commit is contained in:
Puyodead1
2023-03-18 19:26:14 -04:00
parent d76198d200
commit d12751006e
4 changed files with 166 additions and 10 deletions
+10 -3
View File
@@ -1,7 +1,12 @@
import {
Config,
ConnectedAccount,
ConnectionCallbackSchema,
ConnectionLoader,
DiscordApiErrors,
} from "@fosscord/util";
import fetch from "node-fetch";
import { Config, ConnectedAccount, ConnectionCallbackSchema, DiscordApiErrors } from "../../util";
import Connection from "../../util/connections/Connection";
import { ConnectionLoader } from "../../util/connections/ConnectionLoader";
import { GitHubSettings } from "./GitHubSettings";
interface OAuthTokenResponse {
@@ -89,7 +94,9 @@ export default class GitHubConnection extends Connection {
}).then((res) => res.json());
}
async handleCallback(params: ConnectionCallbackSchema): Promise<ConnectedAccount | null> {
async handleCallback(
params: ConnectionCallbackSchema,
): Promise<ConnectedAccount | null> {
const userId = this.getUserId(params.state);
const token = await this.exchangeCode(params.state, params.code!);
const userInfo = await this.getUser(token);