Skip to content

Commit

Permalink
fix: trello to support redirectUrls
Browse files Browse the repository at this point in the history
  • Loading branch information
Nabhag8848 committed May 24, 2024
1 parent 85dffaf commit 85704e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packages/backend/routes/v1/ticket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ ticketRouter.get('/trello-request-token', async (req, res) => {
const accessURL = 'https://trello.com/1/OAuthGetAccessToken';
const authorizeURL = 'https://trello.com/1/OAuthAuthorizeToken';
const expiration = 'never';
const { tenantId, revertPublicToken } = req.query;
const loginCallback = `${config.OAUTH_REDIRECT_BASE}/trello?tenantId=${tenantId}&revertPublicToken=${revertPublicToken}`;
const { tenantId, revertPublicToken, redirectUrl } = req.query;
const loginCallback = `${
config.OAUTH_REDIRECT_BASE
}/trello?tenantId=${tenantId}&revertPublicToken=${revertPublicToken}${
redirectUrl ? `&redirectUrl=${redirectUrl}` : ``
}`;
const account = await prisma.environments.findFirst({
where: {
public_token: String(revertPublicToken),
Expand Down
6 changes: 5 additions & 1 deletion packages/js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,11 @@ const createIntegrationBlock = function (self, integration) {
);
} else if (selectedIntegration.integrationId === 'trello') {
fetch(
`${this.CORE_API_BASE_URL}ticket/trello-request-token?tenantId=${this.tenantId}&revertPublicToken=${this.API_REVERT_PUBLIC_TOKEN}`
`${this.CORE_API_BASE_URL}ticket/trello-request-token?tenantId=${
this.tenantId
}&revertPublicToken=${this.API_REVERT_PUBLIC_TOKEN}${
this.#USER_REDIRECT_URL ? `&redirectUrl=${this.#USER_REDIRECT_URL}` : ``
}`
)
.then((data) => data.json())
.then((data) => {
Expand Down

0 comments on commit 85704e0

Please sign in to comment.