Move redirect uri generation to getRedirectUri function of Connection class.
Use api_endpointPublic instead of cdn_endpointPublic
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
Config,
|
||||
ConnectedAccount,
|
||||
ConnectedAccountCommonOAuthTokenResponse,
|
||||
ConnectionCallbackSchema,
|
||||
@@ -42,14 +41,7 @@ export default class DiscordConnection extends Connection {
|
||||
url.searchParams.append("response_type", "code");
|
||||
// controls whether, on repeated authorizations, the consent screen is shown
|
||||
url.searchParams.append("consent", "none");
|
||||
|
||||
// TODO: probably shouldn't rely on cdn as this could be different from what we actually want. we should have an api endpoint setting.
|
||||
url.searchParams.append(
|
||||
"redirect_uri",
|
||||
`${
|
||||
Config.get().cdn.endpointPrivate || "http://localhost:3001"
|
||||
}/connections/${this.id}/callback`,
|
||||
);
|
||||
url.searchParams.append("redirect_uri", this.getRedirectUri());
|
||||
|
||||
return url.toString();
|
||||
}
|
||||
@@ -76,10 +68,7 @@ export default class DiscordConnection extends Connection {
|
||||
client_secret: this.settings.clientSecret!,
|
||||
grant_type: "authorization_code",
|
||||
code: code,
|
||||
redirect_uri: `${
|
||||
Config.get().cdn.endpointPrivate ||
|
||||
"http://localhost:3001"
|
||||
}/connections/${this.id}/callback`,
|
||||
redirect_uri: this.getRedirectUri(),
|
||||
}),
|
||||
)
|
||||
.post()
|
||||
|
||||
Reference in New Issue
Block a user