I'm having issues with trying to sign in via Google on the SoundCloud authorize page (www.soundcloud.com/connect). When a user tries to auth with that, they see a blank page and they are not redirected back to the app. It works fine for the Facebook sign in and regular user/pass sign in.
Asked
Active
Viewed 247 times
1 Answers
0
If you are using WebView the problem is it doesn't support popup windows, and they are required by the auth flow. Got it to work by implementing popup support along the lines of https://stackoverflow.com/a/8022295.
private void setUpWebView() {
webView = new WebView(getContext());
webView.setWebChromeClient(new MyChromeClient());
final WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setSupportMultipleWindows(true);
webView.loadUrl(url);
}
...
final class MyChromeClient extends WebChromeClient {
// Add new webview in same window
@Override
public boolean onCreateWindow(WebView view, boolean dialog,
boolean userGesture, Message resultMsg) {
WebView childView = new WebView(getContext());
childView.getSettings().setJavaScriptEnabled(true);
childView.setWebChromeClient(this);
childView.setLayoutParams(FILL);
mContent.addView(childView);
WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
transport.setWebView(childView);
resultMsg.sendToTarget();
return true;
}
// remove new added webview whenever onCloseWindow gets called for new webview.
@Override
public void onCloseWindow(WebView window) {
mContent.removeViewAt(mContent.getChildCount() - 1);
}
}

Community
- 1
- 1

Maxim Gurevich
- 79
- 4