android - Azure Mobile authorization error using Google Login -


when try authorize azure mobile service using google+ login android, error below.

com.microsoft.windowsazure.mobileservices.mobileserviceexception: {"code":401,"error":"error: invalid token format. expected envelope.claims.signature."} 

my authorize codes below.

  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                             }                         }                     } );                 } 

i completed authorization using facebook, , using google play services 7.3.0

an id_token can obtained server side web login. scope using oauth token, not same id_token. id_token need use different scope using web application client id.

// create 'client id web application' @ 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); 

the rest of code should work have actual id_token value.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -