-
Notifications
You must be signed in to change notification settings - Fork 454
fix(iOS): Handle NSNull
in iosCustomBrowser
param for logout
#1070
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@seanfar I tested it, it fixes the problem for me. Thanks! 👍 |
NSNull
in iosCustomBrowser
param for logoutNSNull
in iosCustomBrowser
param for logout
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
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.
Pull Request Overview
This PR addresses an issue in the logout flow on iOS by ensuring that a custom browser parameter handles NSNull values appropriately.
- Adds a conditional check to verify that iosCustomBrowser is not nil or NSNull.
- Falls back to the default external user agent when the custom browser parameter is invalid.
Comments suppressed due to low confidence (1)
packages/react-native-app-auth/ios/RNAppAuth.m:522
- Ensure that there are corresponding tests covering the scenario where iosCustomBrowser is NSNull to prevent regressions.
externalUserAgent = [self getCustomBrowser:iosCustomBrowser];
id<OIDExternalUserAgent> externalUserAgent = iosCustomBrowser != nil ? [self getCustomBrowser: iosCustomBrowser] : [self getExternalUserAgentWithPresentingViewController:presentingViewController | ||
prefersEphemeralSession:prefersEphemeralSession]; | ||
id<OIDExternalUserAgent> externalUserAgent; | ||
if (iosCustomBrowser != nil && ![iosCustomBrowser isEqual:[NSNull 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.
[nitpick] Consider extracting the null/NSNull check for iosCustomBrowser into a helper method to improve code readability and reuse.
if (iosCustomBrowser != nil && ![iosCustomBrowser isEqual:[NSNull null]]) { | |
if ([self isNonNullObject:iosCustomBrowser]) { |
Copilot uses AI. Check for mistakes.
Hey there @seanfar, I'm trying to reproduce the error locally but don't seem to be able too. Can you verify I'm following the right steps? I am on a more updated RN version with new arch:
my config is;
and I am running in release mode on iOS: Screen.Recording.2025-05-27.at.10.11.28.AM.mp4 |
Hey thanks for the response and testing @zibs - No, that seems correct. I haven't revisited this after I posted, but since then it seems the documentation for migrating to My gut tells me there's likely some discrepancy between what we currently have setup in our project and what's outlined there, as we had migrated it by hand before these instructions existed. We started seeing this issue after a library + RN upgrade to 0.77. I'll double and triple check. If it's on our end, I'll make sure to close this PR out. But if we're still seeing issues, I'll try to get you a minimal repro as soon as possible. Thank you again! |
Sounds great, thank you! |
following up as promised. After ensuring our still curious how we weren't the only ones seeing this in our project, but it could very well be something similar. cc: @sepperousseau - you may want to verify your project is setup correctly as well. Happy to help however I can. thank you both again! |
Description
While there isn't an issue created specifically for what this PR is attempting to address, there are a few issues that seem to be related to it.
#1061 for example, which led to the fix introduced by #1064 addressed an issue on the
authorize
function.Unfortunately, the
logout
function is still failing to properly display the browser, causing the flow to silently fail wheniosCustomBrowser
is not provided, as the call to[self getCustomBrowser:NSNull]
returnsnil
.This seems to be happening on RN V0.77.1 with the new architecture enabled. Untested on other versions.
This PR adds a guard to fallback to the default external user agent when
iosCustomBrowser
isnil
orNSNull
.Steps to verify
iosCustomBrowser
option that includes:authorize(config)
andlogout(config)
in your code.authorize
(login) andlogout
calls via your application.