In my application, my requirement is to get user photos and show in my application.
To do this, I authenticate, received an access token and enter the user password, but this shows that you do not have permission to open this page. Next, how can I get a user profile and photos.
here is my code:
String url ="https://instagram.com/oauth/authorize?" +"response_type=token" + "&redirect_uri=" + CALLBACK_URL+"&scope=basic"+"&client_id=" + CLIENT_ID ; WebView webview = (WebView)findViewById(R.id.webview); webview.setWebViewClient(new WebViewClient() { public void onPageStarted(WebView view, String url, Bitmap favicon) { String fragment = "#access_token="; int start = url.indexOf(fragment); if (start > -1) { // You can use the accessToken for api calls now. String accessToken = url.substring(start + fragment.length(), url.length()); Log.v(TAG, "OAuth complete, token: [" + accessToken + "]."); Log.i(TAG, "" +accessToken); Toast.makeText(ActivityWebView.this, "Token: " + accessToken, Toast.LENGTH_SHORT).show(); } } }); webview.loadUrl(url); }
source share