I'm trying to develop an app in Android using WSO2's and OAuth. When I create WebView in MainActivity I wrote the lollowing Code:
auth_dialog = new Dialog(MainActivity.this); auth_dialog.setContentView(R.layout.auth_dialog); web = (WebView) auth_dialog.findViewById(R.id.webview); web.getSettings().setJavaScriptEnabled(true); web.loadUrl("https://localhost:9443/oauth2/authorize?response_type=code&client_id=" + CLIENT_ID + "&redirect_uri=" + REDIRECT_URI);
I think the error is in the url that step as a parameter to loadURL (). how do I fix?
I guess the URL host name is wrong. It should have the hostname of the server where IS is hosted. If you are running this on android,
localhostwould refer to the device itself, not the server IS is hosted.If you are running this in an emulator, you should use
10.0.2.2instead oflocalhostto refer the development machine.