Skip to content

Fix invalid scheme with iOS 14.5 #262

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 2 commits into from
Jun 25, 2021

Conversation

SimonIT
Copy link
Contributor

@SimonIT SimonIT commented May 10, 2021

PR Checklist

What is the current behavior?

Exception with invalid scheme is thrown

What is the new behavior?

The scheme will be escaped by default

Fixes/Implements/Closes #256

I tried testing this change with the example but there occurred just more errors. I fixed the flipper and babbel one and then gave up.
I hope everything will work. I'm not very familiar with iOS so don't bash me if I made something wrong. I just need the fix.

@jdnichollsc
Copy link
Member

Hello mate, thanks for your collaboration

Do you know if this change is a breaking change for old versions of iOS? :)

@SimonIT
Copy link
Contributor Author

SimonIT commented May 11, 2021

Hi,
I quick researched the addingPercentEncoding method. I came to the result that the method is available since iOS 7.0+. I don't know if a version check is needed. I couldn't find the iOS minimum version for this lib.
I couldn't find information since when it is possible to use an escaped callbackURLScheme

@SimonIT
Copy link
Contributor Author

SimonIT commented May 17, 2021

I just researched the iOS version requirement for react native: iOS 7.0+ is required since 0.14.0 which came out 2015 (source facebook/react-native@e2841c0). So I would say that this is pretty safe

@jdnichollsc
Copy link
Member

jdnichollsc commented May 17, 2021

Awesome, thanks for letting me know! @maoapp is going to help us with a new release including these changes <3

@waltershub
Copy link

@jdnichollsc why isn't this merged yet

@jdnichollsc
Copy link
Member

I'm busy, maybe @maoapp too 🙂
Let me confirm you 👍

@exception
Copy link

Similar issue resolved here https://github.com/auth0/react-native-auth0/pull/369/files, this was a breaking change with iOS 14.5

@hszouszcz
Copy link

Let me gently poke you one more time (:

@ftlno
Copy link

ftlno commented Jun 1, 2021

Any chance of this getting merged soon?

@janicduplessis
Copy link
Contributor

I think using [[NSURL alloc] initWithString:redirectURL].scheme; to extract only the scheme part from the URL would be a better fix, like what was done in https://github.com/auth0/react-native-auth0/pull/369/files

@jdnichollsc
Copy link
Member

@SimonIT what do you think? 🙂

@SimonIT
Copy link
Contributor Author

SimonIT commented Jun 2, 2021

If it works, why not. I personally don't see the benefit of it

@SimonIT
Copy link
Contributor Author

SimonIT commented Jun 2, 2021

Just tried it myself, seem to work fine

@janicduplessis
Copy link
Contributor

The api expects only the scheme part of the URL so I think it is better to do that instead of encoding the slashes to bypass the validation check.

@jdnichollsc
Copy link
Member

Agree! Please let me know folks <3
PD: In the meantime, do you know if this issue is fixed by using encodeURIComponent('my-scheme://') from JS side? 🤔

@SimonIT
Copy link
Contributor Author

SimonIT commented Jun 3, 2021

I actually don't know and I can't try it, because I'm not directly using this lib. Another lib I'm using is using this lib. That's why this fix is so important for me.
By the way, I updated it to only use the scheme

@PhilippBurgk
Copy link

PhilippBurgk commented Jun 5, 2021

If someone has a direct dependency and needs this fix, you can do the following:

Change the dependency to the commit hash (package.json).
"react-native-inappbrowser-reborn": "https://github.com/SimonIT/react-native-inappbrowser#b35ef11f48c072971ec61049dc1370678db2dac1",

@zachnicoll
Copy link

Any updates on getting this merged?

@akubara
Copy link

akubara commented Jun 11, 2021

Agree! Please let me know folks <3
PD: In the meantime, do you know if this issue is fixed by using encodeURIComponent('my-scheme://') from JS side? thinking

Yep, Platform.OS === 'android' ? deeplinkUri : encodeURIComponent(redirectUri), works on ios 14.5+

@rainyer
Copy link

rainyer commented Jun 21, 2021

Any updates on getting this merged?

+1

@jdnichollsc
Copy link
Member

I'm going to publish this change today, thanks folks! <3

@jdnichollsc jdnichollsc merged commit 1e4c489 into proyecto26:develop Jun 25, 2021
@SimonIT SimonIT deleted the fix-invalid-scheme-error branch June 25, 2021 23:14
@jdnichollsc jdnichollsc mentioned this pull request Jun 26, 2021
@markl-vesper
Copy link

markl-vesper commented Oct 3, 2021

I'm getting this error on 3.6.3

Update- I think what happened there was that as part of testing the app with or without the browser and different versions a pod install might have been missed

But after removing InnAppBrowser from package.json, yarn install, pod install, add back to package.json, yarn install, pod install, react-native run-ios

Still getting the same error

Update- Looks like one final run-ios sorted it out. Odd but it seems to be working now

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.

Exception: The provided scheme is not valid iOS 14.5