-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/invalid credentials #5120
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
||
import appStore from ".."; | ||
|
||
const log = logger.getChildLogger({ prefix: ["CalendarManager"] }); | ||
|
||
export const getCalendar = (credential: Credential | null): Calendar | null => { | ||
export const getCalendar = (credential: CredentialPayload | null): Calendar | null => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the changes includes changing the type that was being used for Credential that isn't allowing for optional fields.
if (responseBody.error === "invalid_grant") { | ||
return Promise.reject(new Error("Invalid grant for Cal.com zoom app")); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If invalid_grant is received we should invalidate the credential right away.
throw Error(response.statusText); | ||
} | ||
|
||
return response.json(); | ||
}; | ||
|
||
const invalidateCredential = async (credentialId: Credential["id"]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our function that invalidate certain credential
}; | ||
}>; | ||
|
||
export type CredentialWithAppName = CredentialPayload & { appName: string }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A help type definition to use when requiring Credential Type from DB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great job, very useful for the users!
I was just wondering, is this a retroactive change for existing credentials? If not, would it be worth in executing some script? Also, perhaps it would be worth exploring running such a script with an email notification added, so users can be aware their apps will not work as expected, before anyone books a new event and they don't get the desired behavior out of their installed apps.
On another note, as a user I would prefer the app facilitates an action to let me delete and reinstall all in one, instead of providing a delete button to then having to go search the app again and reinstall it. Within this context, we know the app already, we could just add a delete & reinstall alongside the delete button, WDYT @Jaibles?
About retroactive this should work with existing credential, we just missing a way to invalidate them. (Zoom its the only one right now).
|
* Fixing types from handleErrorJson usage and Credential * Replace credential prisma type for a better suitable * Improvements on zoom video adapter * Renamed extendedCredentialType and put it in a best suited file * Frontend display invalid credential * Fix styles and text * Fix type required for fake daily credentials
* Fixing types from handleErrorJson usage and Credential * Replace credential prisma type for a better suitable * Improvements on zoom video adapter * Renamed extendedCredentialType and put it in a best suited file * Frontend display invalid credential * Fix styles and text * Fix type required for fake daily credentials
What does this PR do?
Adds a way to invalidate credentials, so we can now let the user now when an integration has broken.
Environment: Staging(main branch)
Type of change
How should this be tested?
Checklist