Go to admin.google.com and select security:
Then select API Controls:
and then click on the link for Manage Domain Wide Delegation:
Click on “Add new.” The following pop-up will display:
Find the client id in the json file you downloaded earlier. Paste that in the Client ID field.
In the oAuth Scopes (comma-delimited) field paste the following string:
https://www.googleapis.com/auth/admin.directory.group,https://www.googleapis.com/auth/admin.directory.user,https://www.googleapis.com/auth/drive
Click Authorize.
Next Step: Increase Quotas