Java Code Examples for cn.bmob.v3.BmobUser#loginWithAuthData()

The following examples show how to use cn.bmob.v3.BmobUser#loginWithAuthData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoginActivity.java    From Conquer with Apache License 2.0 5 votes vote down vote up
@Override
public void onComplete(Object o) {

    try {
        JSONObject jsonObject = new JSONObject(o.toString());
        String userId = jsonObject.getString("openid");
        String expiresIn= jsonObject.getString("expires_in");
        String accessToken = jsonObject.getString("access_token");
        BmobUser.BmobThirdUserAuth authInfo = new BmobUser.BmobThirdUserAuth("qq", accessToken, expiresIn, userId);
        BmobUser.loginWithAuthData(context, authInfo, new OtherLoginListener() {

            @Override
            public void onSuccess(JSONObject userAuth) {
                L.i("QQ授权成功去校验" + userAuth.toString());
                getQQInfo(userAuth);
            }

            @Override
            public void onFailure(int code, String msg) {
                // TODO Auto-generated method stub
                Log.i("smile", "第三方登陆失败:" + msg);
            }

        });

    } catch (JSONException e) {
        e.printStackTrace();
    }
}
 
Example 2
Source File: BmobHelper.java    From Jide-Note with MIT License 4 votes vote down vote up
public static void loginWithAuth(Context context,String snsType,String accessToken,String expiresIn,String userId,
                          OtherLoginListener listener){
    BmobUser.BmobThirdUserAuth authInfo = new BmobUser.BmobThirdUserAuth(snsType,accessToken, expiresIn,userId);
    BmobUser.loginWithAuthData(context, authInfo, listener);

}