-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
WebAuthenticator not working with Mozilla Firefox #117
Comments
I experienced the same issue. The quotation marks expected in the JSON string value of the state parameter are being removed by Firefox. This did not occur in Chrome. Firefox: Chrome: As a result, the call to JsonObject.Parse(state) throws an exception due to the improperly formed JSON.
I was able to resolve by changing this:
to this:
|
Thanks that's a good find. However the datastring should already be getting encoded, so I don't really get this. This smells like a firefox bug |
I'm also getting this in MAUI. I had to register a key otherwise the state appInstance was always a blank string. Microsoft.Windows.AppLifecycle.AppInstance.FindOrRegisterForKey("hello"); I think maybe this is a bug? The CheckOAuthRedirectionActivation method has code to set that string, but it returns early if the app activation wasn't by protocol handler. Even after that, with Firefox as default browser the JSON state is coming back with unquoted strings. Presumably Firefox is stripping them somehow.
With the following patches applied the authentication completes: |
@dotMorten are you still maintaining this project? This bug is still relevant in the workaround for MAUI's WebAuthenticator in Windows, since the SDK still doesn't handle this properly. If this is fixed, this library can be used as a universal fix for Windows WebAuthenticator. As far as I can see, the code @shv07 wrote fixes it. However, I would like to suggest another fix: when passing state in the original URL, it does not respect this state and overwrites it. I've changed the code a little bit to restore the original state in the query parameter. Is his code OK and would you consider merging it? If you do not, I can fork and PR my changes (the same bug fixed and restores original state). What requirements would you have for merging that fix? |
??? That last release was merely a month ago. |
I didn't mean to offend you or say you don't spend enough time on it. Sorry if you understood that from it, I only looked at the last commit. No, I did not open an issue with Firefox, I'm not very familiar with their bug reporting process and don't fully understand the bug. I've tested with Chrome and Edge, my fix doesn't seem to break those browsers, but it does add unnecessary double encoding. I will try to see if I can reproduce the bug and report it at Firefox. I understand if you don't want to fix this on your side, for now I think it's easier to use a WebView because even when using this package as a workaround, it doesn't work for all browsers. Thank you for your work on the package regardless! |
@dotMorten @shv07 @oliverholliday I've tested it out a bit, and found out it is indeed a Firefox problem. Fixing this in your code would be nice to get something working fast, but I agree they should fix it. Reported it at Bugzilla. |
Hi,
I am using your WebAuthenticator for authenticating a MAUI windows app. The authenticator works correctly with edge and chrome browsers. But when I set Mozilla as default browser, the browser opens, accepts login credentials, brings the app in the foreground but the control is never returned to the MAUI app.
On Debugging the WebAuthenticator.cs I found this:-
Here, the control never returns to the last line after the second last is executed.
Using with Windows 11 and Firefox 111.0.1 (64-bit).
The text was updated successfully, but these errors were encountered: