博览会android独立应用程序:阻止webview重定向到应用程序

时间:2019-06-25 05:39:38

标签: android ios react-native expo deep-linking

嗨,我在应用程序中有一个Web视图,其中使用身份服务器显示了身份验证页面。一旦通过身份验证,由于redirect_uri,它将重定向到应用程序。

由于Webview已经在应用程序内部,因此我不需要Webview来调用redirect_uri来打开应用程序的新实例。

有没有办法拦截它?在android上,不支持对本地webView onShouldStartLoadWithRequest进行响应。在expo客户端中运行时,我可能会拦截,它将停止重定向到应用程序的形式。

<WebView source={ { uri:loginSrc}} 
                ref={(ref) => {this.webView = ref; }}
                onNavigationStateChange={(e) => {
                  console.log("URL DATA Received");
                  console.log(e.url);
                  // if (e.url.startsWith("io.test.com://")) {
                  //   console.log("Go back to login")
                  //   e.goBack();
                  // }
                }}
                onShouldStartLoadWithRequest={
                  (data) => 
                  { 
                    //console.log("start request"); console.log(data);   
                    if (data.url.includes("#code")) {
                      this.setState({showLoginModal: false});
                      this._onExtractCode(data);
                      return false;
                    }
                    //console.log("end request");
                    return true;
                  }} ></WebView>

或者有什么方法可以防止深度链接到我的应用程序

http://uat-login.funny.com/Account/Login?ReturnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fnonce%3Dtesting%26client_id%3Dslon_hybrid%26scope%3Dopenid%2520profile%2520email%2520lynx%2520slon%2520offline_access%26redirect_uri%3Dio.test.com%253A%252F%252F%253Fcallback%253Dauthentication%26response_type%3Dcode%2520id_token

在url上方,有一个redirect_uri,它将打开该应用程序的新实例。有没有办法取消该请求。

0 个答案:

没有答案