auth0 / auth0-oidc-client-net

OIDC Client for .NET Desktop and Mobile applications
https://auth0.github.io/auth0-oidc-client-net/
Apache License 2.0
86 stars 49 forks source link

Using Xcode 12.5 and iOS 14.5: The provided scheme is not valid. A scheme should not include special characters such as ":" or "/". #189

Closed sstuenkel closed 3 years ago

sstuenkel commented 3 years ago

Describe the problem

Trying to authenticate on iOS using Xcode 12.5 and iOS 14.5 results in the Exception: The provided scheme is not valid. A scheme should not include special characters such as ":" or "/".

The same error is described here: https://github.com/auth0-samples/auth0-react-native-sample/issues/45 and there is already a PR pending, so I think this should be an easy fix.

mduchev commented 3 years ago

I can confirm that the same is happening on my end. Just a small correction - the latest Xcode version is 12.5. Xcode versions below 12.5 are working flawlessly. Even Xcode 12.5 and iOS version lower than 14.5 is working again. The problem is when we have both latest Xcode (12.5) & iOS (14.5) versions.

There is already a PR made - https://github.com/auth0/react-native-auth0/pull/369 that fixes https://github.com/auth0/react-native-auth0/issues/360

frederikprijck commented 3 years ago

Thanks for reporting this, looks like this is indeed an issue.

We will look into this as soon as possible and see if the fix is close to identical as to the fix we did for the React Native SDK.

MarkusHorstmann commented 3 years ago

It appears that the fix (or at least a workaround) is in https://github.com/auth0/auth0-oidc-client-net/blob/master/src/Auth0.OidcClient.iOS/ASWebAuthenticationSessionBrowser.cs, line 59: options.EndUrl, => new NSUrl(options.EndUrl).Scheme,

sstuenkel commented 3 years ago

In the meantime you can downgrade to SFAuthenticationSessionBrowser as a workaround:

var client = new Auth0Client(new Auth0ClientOptions { Domain = "YOUR_AUTH0_DOMAIN", ClientId = "YOUR_AUTH0_CLIENT_ID", Browser = new SFAuthenticationSessionBrowser() });

mduchev commented 3 years ago

I can confirm that the workaround works fine. I suppose that the fix is indeed in the indicated lines above. We'll wait for a new release then.

errolcash commented 3 years ago

In the meantime you can downgrade to SFAuthenticationSessionBrowser as a workaround:

var client = new Auth0Client(new Auth0ClientOptions { Domain = "YOUR_AUTH0_DOMAIN", ClientId = "YOUR_AUTH0_CLIENT_ID", Browser = new SFAuthenticationSessionBrowser() });

I tried this and i now get an error from the browser stating that the address is invalid. This workaround seems to still not work for me.

frederikprijck commented 3 years ago

Hey all, I opened a PR that should fix this. Feel free to verify if it solves your problems.