socialauth-android授权成功与Facebook,但验证码为null [英] socialauth-android authorization successfull with Facebook but verification code is null

查看:206
本文介绍了socialauth-android授权成功与Facebook,但验证码为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用socialauth-android让我的Android用户在Facebook上进行身份验证。

I'm using socialauth-android to let my Android users authenticate themselves on Facebook.

我的问题如下:

我可以成功显示Facebook登录页面,用户可以输入凭据并授权我的应用程序。
当授权完成时,应该调用链接到SocialAuthAdapter的ReponseListener的回调方法onComplete。

I can successfully display the Facebook log in page where the user can enter the credentials and authorize my app. When the authorization is complete, the callback method onComplete of the ReponseListener linked to SocialAuthAdapter should be invoked.

我从来没有发生过异常说验证码是空的,但我可以在Facebook用户页面看到我的应用程序已被授权。

看来,成功授权后,提供商也期望验证码,以便客户端可以将其包含在下一个请求中。

It seems that after the successful authorization, a verification code is also expected by the provider so that the client can include it in the next requests.

我还不明白这个空代码是用户会话令牌或别的东西。

I've also not understood if this null code is the user session token or something else.

有没有人遇到类似的问题?
如何解决?

Has anyone encountered a similar issue? How to resolve it?

我将Facebook应用程序配置为Native Android应用程序,如图所示

I've configured my Facebook app as Native Android App as shown in the picture

显示了简化版本的代码。

The simplified version of the code is shown.

public class LoginActivity extends Activity {

private static final String LOG_TAG = "LoginActivity";

SocialAuthAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    adapter = new SocialAuthAdapter(new ResponseListener());

            //  [.....]
}
/**
* This method is invoked when the user click on my Facebook button to initiate the
* the authentication process with Facebook
*/
protected void doLogin(){
    adapter.authorize(this, Provider.FACEBOOK);
}

private final class ResponseListener implements DialogListener {

   @Override
   public void onComplete(Bundle values) {

     // Variable to receive message status
     if (Log.isLoggable(LOG_TAG, Log.DEBUG)) {
       Log.d(LOG_TAG, "Authentication Successful"); 
     }

     adapter.getUserProfileAsync(new SocialAuthListener<Profile>() {

        @Override
        public void onError(SocialAuthError arg0) {

           Log.e(LOG_TAG, "Cannot retrieve user profile");

        }

        @Override
        public void onExecute(Profile profile) {

           Log.d(LOG_TAG, "ValidatedId = " + profile.getValidatedId()); 

     });

  }

堆栈跟踪是

Retrieving Access Token in verify response function
Verifying the authentication response from provider
org.brickred.socialauth.exception.SocialAuthException: Verification code is null
at org.brickred.socialauth.oauthstrategy.OAuth2.verifyResponse(OAuth2.java:114)
at org.brickred.socialauth.oauthstrategy.OAuth2.verifyResponse(OAuth2.java:102)
at  org.brickred.socialauth.provider.FacebookImpl.doVerifyResponse(FacebookImpl.java:164)
at org.brickred.socialauth.provider.FacebookImpl.verifyResponse(FacebookImpl.java:154)
at org.brickred.socialauth.SocialAuthManager.connect(SocialAuthManager.java:183)
at  org.brickred.socialauth.android.SocialAuthDialog$SocialAuthWebViewClient$1.run(SocialAuthDialog.java:243)
at java.lang.Thread.run(Thread.java:856)
org.brickred.socialauth.exception.SocialAuthException: Verification code is null
org.brickred.socialauth.android.SocialAuthError: Unknown Error


推荐答案

http://code.google.com/p/socialauth- android / issues / detail?id = 52

http://code.google.com/p/socialauth-android/issues/detail?id=52

你已经授权你的app

You have already authorized yourapp

回答一个类似的问题。只需更新jar并删除以前的jar。请记住,(jars)还在测试阶段。

This has been fixed and answered on a similar question. Just Update the jars and remove previous ones. Keep in mind that it (jars) is still on testing stage.

这篇关于socialauth-android授权成功与Facebook,但验证码为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆