0

Hi All Geniuses buddies

I am using google admin apis. user provisioning is what i successfully performed. When i try to move the same user to Organisational Unit(OU). It give me error like

{"The remote server returned an error: (403) Forbidden."} You are not authorised to access this api.

I am not able to figure out which api i need to trun on for that. Here are the api i have truned on.enter image description here

This it the code i am using to perform the same

            //Method 1
 OrganizationService serviceNew = new OrganizationService("Domain", "User Provisioning");

 serviceNew.setUserCredentials("Admin Email Account", "Password");


 serviceNew.UpdateOrganizationUser("Customer ID", "The Email Account i want to add", "/OU Name", "/");

I dont know why its not working.

!Any help, It will be appreciated.

OyeHarish
  • 320
  • 2
  • 8
  • Does the user have administration permissions? have you granted the app to access that kind of information in the admin console? – Gerardo Dec 17 '14 at 00:53
  • Thanks gerardo. All the apis mentioned above are truned on. where do i need to grant access else? – OyeHarish Dec 17 '14 at 18:28

2 Answers2

0

You have to grant the application access to your domain. In the Admin Console of your domain go to (admin.google.com): Security > Advanced Settings > In the Authentication section go to "Manage API client access"

There you have to add the client name, which is the client id of the app (looks like a long email) and in the field "One or More API Scopes" you have to add the all scopes that your app is using separated by a comma.

Gerardo
  • 3,460
  • 1
  • 16
  • 18
0

I did some changes to my code. Instead of moving user to Organisation Unit,I just updated it to the Organisation Unit path. And See What it worked like charm. :) Thanks Gerardo, for showing interest. Keep the good work going.

OyeHarish
  • 320
  • 2
  • 8