Google Directory API setPassword() Java

75 Views Asked by At

I need help about Google directory API. I follow this tutorial and every works well, I mean that i have the list of the users. But I want that my application updates a password user.

I just complete the code of the file DirectoryQuickStart.java with:

User u = users.get(3);
String password = "NewPassword";
u.setPassword(password);
service.users().update(u.getId(),u).execute();

You must read the tutorial to understand :) I have a problem during the compilation: Insufficient Permission error 403:

http://postimg.org/image/4gxuli8b5/

I think this problem is in the developper console or in the security parameter in the admin console... I don't understand

Thanks in advance for your answer.

1

There are 1 best solutions below

0
On

It can be that you have not included the scope for updating users which is https://www.googleapis.com/auth/admin.directory.user in your request. Go To Google Directory API reference and from Try It, check if an update for password works from there. The link is this