首页 > 解决方案 > 将来自 CustomTabsIntent 授权的 facebook 登录返回给应用程序

问题描述

我的应用程序打开网页以登录应用程序抛出 webview。此页面包含额外的登录抛出 facebook。facebook https://developers.facebook.com/docs/facebook-login/android/deprecating-webviews的最新更改不允许在一个 web 视图中打开 facebook 登录页面。所以我创造

webview.setWebViewClient(new WebViewClient() {
  public boolean shouldOverrideUrlLoading(WebView view, String url) {
  if (url.contains("facebook")) {

     CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
     CustomTabsIntent customTabsIntent = builder.build();
     customTabsIntent.intent.setFlags(FLAG_ACTIVITY_NEW_TASK);
     customTabsIntent.launchUrl(getApplicationContext(), Uri.parse(url));
     return true;
   }
}

但是我怎样才能返回我的登录页面并检索 Facebook 授权?

授权有效,但它会在新的 chrome 选项卡中打开我的数据,而不是在我的应用程序中。

标签: androidfacebooktabsauthorizationnew-operator

解决方案


推荐阅读