Skip to content

Commit

Permalink
fix: Added revert redirect uri
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutosh-revert authored and jatinsandilya committed Apr 4, 2024
1 parent e3353d9 commit e2bbaac
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/app-store/hubspot-revert/api/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
res.status(200).json({
url: `https://app.hubspot.com/oauth/authorize?client_id=${
appKeys.client_id
}&redirect_uri=http://localhost:3010/oauth-callback/hubspot&state={%22tenantId%22:%22${tenantId}%22,%22revertPublicToken%22:%22${
}&redirect_uri=https://app.revert.dev/oauth-callback/hubspot&state={%22tenantId%22:%22${tenantId}%22,%22revertPublicToken%22:%22${
process.env.REVERT_PUBLIC_TOKEN
}%22}&scope=${scopes.join("%20")}`,
newTab: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/app-store/salesforce-revert/api/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const queryParams = {
response_type: "code",
client_id: consumer_key,
redirect_uri: `https://a3f9-103-183-24-51.ngrok-free.app/oauth-callback/sfdc`,
redirect_uri: `https://app.revert.dev/oauth-callback/sfdc`,
state: `{%22tenantId%22:%22${tenantId}%22,%22revertPublicToken%22:%22${process.env.REVERT_PUBLIC_TOKEN}%22}`,
};

Expand Down
9 changes: 2 additions & 7 deletions packages/app-store/zohocrm-revert/api/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,14 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
});
const tenantId = teamId ? teamId : userId;
// @TODO check scopes before deployment
const scopes = [
"ZohoCRM.modules.ALL",
"ZohoCRM.settings.ALL",
"ZohoCRM.users.ALL",
"AaaServer.profile.READ",
];
const scopes = ["ZohoCRM.modules.ALL", "ZohoCRM.users.READ", "AaaServer.profile.READ"];

const queryParams = {
scope: scopes.join(","),
client_id,
response_type: "code",
access_type: "offline",
redirect_uri: "http://localhost:3010/oauth-callback/zohocrm",
redirect_uri: "https://app.revert.dev/oauth-callback/zohocrm",
state: `{%22tenantId%22:%22${tenantId}%22,%22revertPublicToken%22:%22${process.env.REVERT_PUBLIC_TOKEN}%22}`,
};

Expand Down
10 changes: 6 additions & 4 deletions packages/app-store/zohocrm-revert/lib/CalendarService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default class ZohoCRMRevertCalendarService implements Calendar {
return await fetch(`${this.revertApiUrl}crm/events/${uid}`, requestOptions);
};

private deleteMeeting = async (uid: any) => {
private deleteMeeting = async (uid: string) => {
const headers = new Headers();
headers.append("x-revert-api-token", this.revertApiKey);
headers.append("x-revert-t-id", this.tenantId);
Expand All @@ -180,9 +180,10 @@ export default class ZohoCRMRevertCalendarService implements Calendar {
const meetingEvent = await (await this.createZohoCRMEvent(event, contacts)).json();
if (meetingEvent && meetingEvent.status === "ok") {
this.log.debug("event:creation:ok", { meetingEvent });

return Promise.resolve({
uid: meetingEvent.result.id,
id: meetingEvent.result.id,
uid: meetingEvent.result.details.id,
id: meetingEvent.result.details.id,
type: appConfig.slug,
password: "",
url: "",
Expand Down Expand Up @@ -296,6 +297,7 @@ export default class ZohoCRMRevertCalendarService implements Calendar {
);

await this.createContacts(nonExistingContacts);

const meetingEvent = await (await this.updateMeeting(uid, event)).json();
if (meetingEvent && meetingEvent.status === "ok") {
this.log.debug("event:updation:ok", { meetingEvent });
Expand All @@ -312,7 +314,7 @@ export default class ZohoCRMRevertCalendarService implements Calendar {
return Promise.reject("Something went wrong when updating a meeting in ZOHO CRM");
}

async deleteEvent(uid: any): Promise<void> {
async deleteEvent(uid: string): Promise<void> {
await this.deleteMeeting(uid);
}

Expand Down

0 comments on commit e2bbaac

Please sign in to comment.