[英]SoundCloud API for Android - Google+ - SignIn not working
I am using the SoundCloud API in my application and I wish to add support for Google + Sign in. Facebook and email sign in works well. 我在我的应用程序中使用SoundCloud API,我希望添加对Google +登录的支持.Facebook和电子邮件登录效果很好。
I followed the steps from [ https://developers.soundcloud.com/docs/api/reference][1] and used an WebView to display the connect URL. 我按照[ https://developers.soundcloud.com/docs/api/reference][1]中的步骤操作,并使用WebView显示连接URL。 For FB login I was sent to the redirect_uri specified by me but for Google+ this does not happen and I am returned to a blank page.
对于FB登录,我被发送到我指定的redirect_uri,但对于Google+,这不会发生,我将返回到空白页面。
Should I add any Google+ special settings? 我应该添加任何Google+特殊设置吗?
[UPDATE] And the URL from the webview is: [更新]来自webview的URL是:
https://accounts.google.com/o/oauth2/auth?zt=ChRrSW5rQzhRb0FCN2FXYmN2OUU3UBIfSWgtRWd0QlJVcThSWUZacjk1dXlndlZSZ0syTWx3SQ%E2%88%99APsBz4gAAAAAVO80WV2bOdZGqYKRwpTOIlAweRpfRufL&from_login=1&hl=ro&as=-3b89b18baa28338a https://accounts.google.com/o/oauth2/auth?zt=ChRrSW5rQzhRb0FCN2FXYmN2OUU3UBIfSWgtRWd0QlJVcThSWUZacjk1dXlndlZSZ0syTWx3SQ%E2%88%99APsBz4gAAAAAVO80WV2bOdZGqYKRwpTOIlAweRpfRufL&from_login=1&hl=ro&as=-3b89b18baa28338a
Thank you. 谢谢。
this is what I am doing for SoundCloud
login
这就是我为
SoundCloud
login
所做的事情
web.getSettings().setJavaScriptEnabled(true);
web.loadUrl(url+"&client_id="+CLIENT_ID+"&redirect_uri=http://localhost&response_type=token&scope=non-expiring&display=popup");
web.setWebViewClient(new WebViewClient() {
boolean authComplete = false;
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon){
super.onPageStarted(view, url, favicon);
progress_dialog.show_message("Connecting SoundCloud");
progress_dialog.show_dialog();
}
String authCode="";
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
progress_dialog.Cancel_dialog();
Log.i("URLLLL", url);
if (url.contains("access_token=") && authComplete != true) {
for(int t=32;t<url.length();t++){
if(!(url.charAt(t) == '&'))
authCode = authCode+url.charAt(t);
else
break;
}
Log.i("CODE true", "CODE : " + authCode);
authComplete = true;
SharedPreferences.Editor edit = pref.edit();
edit.putString("SoundCloud_Code", authCode);
edit.putInt("SoundCloud_signinflag", 1);
edit.commit();
sign_in_flag = 1;
auth_dialog.dismiss();
new getprofile().execute();
}else if(url.contains("error=access_denied")){
Log.i("CODE false", "ACCESS_DENIED_HERE");
authComplete = true;
auth_dialog.dismiss();
}
}
});
auth_dialog.show();
and it is just working perfect. 它只是工作完美。
Please try this. 请试试这个。
This questions has been answered here: Soundcloud API mobile OAUTH login using Google+ isn't working on Android 此问题已在此处得到解答: 使用Google+的Soundcloud API移动OAUTH登录无法在Android上运行
I created a github project here which has a fully working implementation. 我在这里创建了一个github项目,它有一个完全可行的实现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.