Skip to content

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

Merged
merged 5 commits into from
Nov 8, 2022
Merged

Fix OAuth login buttons #19135

merged 5 commits into from
Nov 8, 2022

Conversation

timroes
Copy link
Contributor

@timroes timroes commented Nov 8, 2022

What

This fixes several issues with the OAuth connectors atm:

  • The new connectorFormContext does no longer contain selectedService and selectedConnector, but the consuming places were not adjusted to that yet. This fixes the consuming places and the types.
  • We were no longer calling getValues since the refactor to the useAuthentication hook, which would cause connectors (like Bing Ads), which had a predicateKey referencing a field that only had a const value to no longer show. Since the getValues method is the one that put that const value as a default value into the Formik values.
  • Some connectors would say "Re-authenticate" even before authentication (e.g. Bing), because they had a default value for one of the OAuth flow fields of empty string, which caused our check for undefined 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.

@timroes timroes added type/bug Something isn't working team/extensibility area/frontend Related to the Airbyte webapp ui/connectors labels Nov 8, 2022
@timroes timroes requested a review from a team as a code owner November 8, 2022 19:36
@github-actions github-actions bot added the area/platform issues related to the platform label Nov 8, 2022
@@ -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 = {
Copy link
Contributor Author

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.

Copy link
Contributor

@dizel852 dizel852 left a 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

@teallarson
Copy link
Contributor

teallarson commented Nov 8, 2022

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.

Copy link
Contributor

@edmundito edmundito left a 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.

Copy link
Contributor

@lmossman lmossman left a 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 👍

@timroes timroes merged commit 8b1095d into master Nov 8, 2022
@timroes timroes deleted the tim/fix-oauth branch November 8, 2022 22:05
akashkulk pushed a commit that referenced this pull request Dec 2, 2022
* Fix OAuth login buttons

* Remove unnecessary "as unknown"

* Prevent empty number fields from breaking

* Fix issue with default values

* Fix unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform team/extensibility type/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants