-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fix OAuth login buttons #19135
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
Fix OAuth login buttons #19135
Conversation
@@ -63,7 +63,7 @@ export const ConnectorFormContextProvider: React.FC<React.PropsWithChildren<Conn | |||
|
|||
const ctx = useMemo<ConnectorFormContext>(() => { | |||
const unfinishedFlows = widgetsInfo["_common.unfinishedFlows"] ?? {}; | |||
return { | |||
const context: ConnectorFormContext = { |
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.
ℹ️ Assigning this object to a variable that's explicitally types, will cause TypeScript to now properly check if the object has keys that it shouldn't have.
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.
Code LGTM
Have not tested locally
Can't approve, but tested locally and am seeing the OAuth button on all OAuth connectors. I do see a bug where the auth method is persisting if i navigate away and often no default auth method is being applied if it is in a oneOf. |
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.
Code changes look good. I have not tested this.
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.
Tested both the OAuth buttons and the empty numeric field behavior locally and it looks to be behaving as expected 👍
* Fix OAuth login buttons * Remove unnecessary "as unknown" * Prevent empty number fields from breaking * Fix issue with default values * Fix unit test
What
This fixes several issues with the OAuth connectors atm:
connectorFormContext
does no longer containselectedService
andselectedConnector
, but the consuming places were not adjusted to that yet. This fixes the consuming places and the types.getValues
since the refactor to theuseAuthentication
hook, which would cause connectors (like Bing Ads), which had apredicateKey
referencing a field that only had aconst
value to no longer show. Since thegetValues
method is the one that put thatconst
value as a default value into the Formik values.default
value for one of the OAuth flow fields of empty string, which caused our check forundefined
though to now think the OAuth flow already ran. This was now changed to a truthy change, so empty string default values in OAuth flow fields no longer mark the button as "Reauthenticate" from the beginning.