Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Open uri with User and password #2069

Open
gabrielrvd opened this issue Dec 23, 2022 · 0 comments
Open

Open uri with User and password #2069

gabrielrvd opened this issue Dec 23, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@gabrielrvd
Copy link

Description

Hi, I try open a URL with user and password in Browser.OpenAsync() and the internal method "Browser.EscapeUri" intercept and create a new URI before call native plataform method and remove userinfo from the URI.

Original URI: http://user:[email protected]
New URI create by Browser.EscapeUri: http://www.example.com

Why method EscapeUri exists? Is possible remove him?

If is not possible remove EscapeUri, create a new method that not call him.

Steps to Reproduce

  1. Open URI with user and password with Browser.OpenAsync(...)
  2. Browser prompt again for user and password

Expected Behavior

Not change URI

Actual Behavior

Remove user and password from new generated URI

Basic Information

  • Version with issue: All
  • IDE: VS2022
  • Platform Target Frameworks: All plataforms

Workaround

For now I call same internal method that Browser.OpenAsync run by reflection

var type = typeof(Xamarin.Essentials.Browser);
var method = type.GetMethod(
                 "PlatformOpenAsync",
                 BindingFlags.NonPublic
                 | BindingFlags.Public
                 | BindingFlags.Static
                 | BindingFlags.FlattenHierarchy)
             ?? throw new NotImplementedException(
                 "Método 'PlatformOpenAsync' não encontrado para a plataforma");

var task = (Task<bool>)method.Invoke(null, new[] { (object)uri, options });
await task;
@gabrielrvd gabrielrvd added the bug Something isn't working label Dec 23, 2022
@gabrielrvd gabrielrvd changed the title [Bug] Open uri with User and password Dec 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant