diff options
Diffstat (limited to 'src/util/connections/Connection.ts')
-rw-r--r-- | src/util/connections/Connection.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util/connections/Connection.ts b/src/util/connections/Connection.ts index 8b60b0d2..26279299 100644 --- a/src/util/connections/Connection.ts +++ b/src/util/connections/Connection.ts @@ -1,7 +1,7 @@ import crypto from "crypto"; import { ConnectedAccount } from "../entities"; import { ConnectedAccountSchema, ConnectionCallbackSchema } from "../schemas"; -import { DiscordApiErrors } from "../util"; +import { Config, DiscordApiErrors } from "../util"; /** * A connection that can be used to connect to an external service. @@ -20,6 +20,16 @@ export default abstract class Connection { abstract getAuthorizationUrl(userId: string): string; /** + * Returns the redirect_uri for a connection type + * @returns redirect_uri for this connection + */ + getRedirectUri() { + const endpointPublic = + Config.get().api.endpointPublic ?? "http://localhost:3001"; + return `${endpointPublic}/connections/${this.id}/callback`; + } + + /** * Processes the callback * @param args Callback arguments */ |