Skip to content

Ensure authentication is passed to swift library correctly - #372

Merged
kiftio merged 1 commit into
prototype/developmentfrom
auth-tweaks
Nov 10, 2025
Merged

kiftio merged 1 commit into
prototype/developmentfrom
auth-tweaks

Conversation

@kiftio

@kiftio kiftio commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

What changes are you making?

  1. Update to take an auth prop, rather than options
  2. Ensure we call invalidate when auth token or URL changes in RCTCheckoutWebView
  3. Move token fetching to before the navigation, to prevent re-renders

Part of the issue is that previously the component was being created multiple times, e.g.

  • once with a URL and undefined token
  • then later (when a token had been fetched) with a URL and defined token

Combined with preloading and a missing invalidate this can cause issues.


We also saw an issue where color scheme changes weren't being reflected in the UI, so have looked at fixing that by moving ConfigProvider up and adding an effect to watch appConfig.colorScheme

PR Checklist

Important

Releasing a new version of the kit?


Tip

See the Contributing documentation for instructions on how to publish a new version of the library.

@kiftio
kiftio requested a review from a team as a code owner November 6, 2025 12:38
/**
* Optional checkout options (authentication, entryPoint)
*/
RCT_EXPORT_VIEW_PROPERTY(checkoutOptions, NSDictionary*)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've removed checkoutOptions from the JS interface so we can remove this I think
Do we need a way to pass entryPoint in still?

Comment thread sample/src/components/BuyNowButton.tsx Outdated
Comment thread sample/ios/ReactNativeTests/CheckoutWebViewTests.swift Outdated
Comment thread sample/ios/ReactNativeTests/RCTCheckoutWebViewTests.swift
Comment thread modules/@shopify/checkout-sheet-kit/ios/RCTCheckoutWebView.swift Outdated
Comment thread modules/@shopify/checkout-sheet-kit/ios/RCTCheckoutWebView.swift Outdated
guard !pendingSetup else { return }
pendingSetup = true

DispatchQueue.main.async { [weak self] in

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did AI ever answer why it has to be async?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to to batch up, by deferring the actual setup to the next run-loop tick..

For that case where both checkoutUrl and auth change, and we only want to create the viewcontroller once. Will double check it's necessary

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, seems necessary, seeing tests fail with multiple setups otherwise

…header

extract token client, add error handling
code review improvements
@kiftio kiftio changed the title some tweaks to ensure branding is applied Ensure authentication is passed to swift library correctly Nov 7, 2025
@kiftio
kiftio merged commit 224d305 into prototype/development Nov 10, 2025
5 of 7 checks passed
@kiftio
kiftio deleted the auth-tweaks branch November 10, 2025 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants