Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使用Google登录时出现Azure移动授权错误_Android_Azure - Fatal编程技术网

Android 使用Google登录时出现Azure移动授权错误

Android 使用Google登录时出现Azure移动授权错误,android,azure,Android,Azure,当我尝试使用Android的Google+登录来授权Azure移动服务时,我得到下面的错误 com.microsoft.windowsazure.mobileservices.MobileServiceException: {"code":401,"error":"Error: Invalid token format. Expected Envelope.Claims.Signature."} 我的授权代码如下 id_token = GoogleAuthUtil.getToken( Pa

当我尝试使用Android的Google+登录来授权Azure移动服务时,我得到下面的错误

com.microsoft.windowsazure.mobileservices.MobileServiceException:
{"code":401,"error":"Error: Invalid token format. Expected Envelope.Claims.Signature."}
我的授权代码如下

  id_token = GoogleAuthUtil.getToken( ParentActivity.this, user_mailAddress,
                                "oauth2:" + Scopes.PLUS_LOGIN + " https://www.googleapis.com/auth/plus.profile.emails.read" );

                        sharedPrefencesHelper.setActiveMailAddress( user_mailAddress );
//                        sharedPrefencesHelper.setActiveUserName( user_name );
//                        sharedPrefencesHelper.setActiveUserSurname( user_surname );
                        sharedPrefencesHelper.setUserConnectStatement( GOOGLE_CONNECT );

                    } catch ( UserRecoverableAuthException e ) {
                        startActivityForResult( e.getIntent(), RC_SIGN_IN );
                    } catch ( IOException | GoogleAuthException e ) {
                        e.printStackTrace();
                    }

                    JsonObject user = new JsonObject();
                    user.addProperty( "id_token", id_token );
                    mClient().login( MobileServiceAuthenticationProvider.Google, user, new UserAuthenticationCallback() {
                        @Override
                        public void onCompleted( MobileServiceUser user, Exception exception, ServiceFilterResponse response ) {
                            if ( exception == null ) {
                                syncronUserInformations( user_mailAddress );

                            } else {
                                exception.printStackTrace();
                                // TODO Azure login olurken bir hata
                            }
                        }
                    } );
                }
我使用facebook完成了授权,我正在使用google play services 7.3.0

id_令牌只能通过服务器端web登录获得。您正在使用的作用域将获得一个OAuth令牌,它与id_令牌不同。要获取id_令牌,您需要使用web应用程序客户端id使用不同的作用域

// Create 'Client ID for web application' at https://console.developers.google.com
String web_client_id = "1234567890-abcdefghijklmnopqrstuvq.apps.googleusercontent.com";

id_token = GoogleAuthUtil.getToken( ParentActivity.this, user_mailAddress,
    "audience:server:client_id:" +  web_client_id);
代码的其余部分现在应该可以工作了,因为您已经有了一个实际的id\u令牌值