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

WKWebViewNavigationDelegate : Support code flow #435

Open
friendly-tech opened this issue Feb 28, 2020 · 1 comment
Open

WKWebViewNavigationDelegate : Support code flow #435

friendly-tech opened this issue Feb 28, 2020 · 1 comment

Comments

@friendly-tech
Copy link

friendly-tech commented Feb 28, 2020

Allow usage of WKWebView with authorization code flow.

When setting the switch WebViewConfiguration.IOS.IsUsingWKWebView = true, the redirect url once hit just stays on the screen and does nothing.

WKWebViewNavigationDelegate seems to only support access tokens via the redirect url and doesnt do the same logic as UIWebView does

public override void DecidePolicy(
        WKWebView webView,
        WKNavigationAction navigationAction,
        Action<WKNavigationActionPolicy> decisionHandler)
      {
        Uri uri = new Uri(webView.Url.AbsoluteString);
        string fragment = uri.Fragment;
        if (fragment.Contains("access_token") || fragment.Contains("state") || (fragment.Contains("expires_in") || fragment.Contains("error")))
          this.controller.authenticator.OnSucceeded(new Account("", (IDictionary<string, string>) new Dictionary<string, string>(WebEx.FormDecode(uri.Fragment))));
        else if (fragment.Contains("code"))
          throw new NotImplementedException("code - Explicit/Server");
        decisionHandler(WKNavigationActionPolicy.Allow);
      }

It should call into this.controller.authenticator.OnPageLoaded(url); and eventually RequestAccessTokenAsync the same as the UIWebView does and not just do nothing like it currently does.

@friendly-tech
Copy link
Author

#411

#413

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant