This error happens when: Step 1: I login with the account: [email protected] I logoff Until now work's fine.
Step 2: I login with the account: [email protected] now the same error appears. Therefore I just login with the first account. EVER. On 27 abr, 09:10, Masami Asai <[email protected]> wrote: > Hello. > > When the following code is executed with user ID and password which is not > the user's password, > the following unexpected error occurs: > com.google.gdata.util.ServiceForbiddenException: Cannot request contacts > belonging to another user > > The expected result should be AuthenticationException. > I'd like to know why instead I am getting the error: > com.google.gdata.util.ServiceForbiddenException: Cannot request contacts > belonging to another user > > Thanks. > > Masami Asai > > ----------------------------------------- > try { > > String _useraddress ="[email protected]"; > String gpass = "googlepassword"; > > Random rnd = new Random(); > rnd.setSeed(new Date().getTime()); > ContactsService myService = new ContactsService("exampleCo-exampleApp-1 " > + rnd.nextInt()); > > // AddressBookUtil.logCnt("google_personal_contacts_auth"); > myService.setUserCredentials(_useraddress, gpass); > System.out.println("auth ok"); > URL feedUrl = new URL("https://www.google.com/m8/feeds/groups/" + > _useraddress + "/full?max-results=100000"); > ContactGroupFeed resultFeed = myService.getFeed(feedUrl, > ContactGroupFeed.class); > String id = null; > Thread.sleep(6000); > System.out.println("finish!"); > // } catch (LdapUtilException e) { > // // TODO Auto-generated catch block > // e.printStackTrace();}catch(AuthenticationException e){ > > System.out.println("auth error");}catch (Exception ee) > > { > ee.printStackTrace(); > > } > > ----------------------------------------- > The result is as follows: > ----------------------------------------- > > auth ok > com.google.gdata.util.ServiceForbiddenException: Cannot request contacts > belonging to another user > <HTML> > <HEAD> > <TITLE>Cannot request contacts belonging to another user</TITLE> > </HEAD> > <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> > <H1>Cannot request contacts belonging to another user</H1> > <H2>Error 403</H2> > </BODY> > </HTML> > > at > com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGData > Request.java:561) > at > com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleG > DataRequest.java:543) > at > com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataReques > t.java:536) > at > com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java > :515) > at > com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest. > java:515) > at com.google.gdata.client.Service.getFeed(Service.java:1073) > at com.google.gdata.client.Service.getFeed(Service.java:936) > at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:631) > at com.google.gdata.client.Service.getFeed(Service.java:955) > at test.main(test.java:67) > ----------------------------------------- -- You received this message because you are subscribed to the Google Groups "Google Contacts, Shared Contacts and User Profiles APIs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://code.google.com/apis/contacts/community/forum.html
