This directory contains some examples how to interact with directory v_1 API.
Authentication is done via JWT.
-
From the Google Developers Console, select your project or create a new one.
-
Under "APIs & auth", click "Credentials".
-
Under "OAuth", click the "Create new client ID" button.
-
Select "Service account" as the application type and click "Create Client ID".
-
The key for your new service account should prompt for download automatically. Note that your key is protected with a password. IMPORTANT: keep a secure copy of the key, as Google keeps only the public key.
-
Convert the downloaded key to PEM, so we can use it from the Node crypto module.
To do this, run the following in Terminal:
openssl pkcs12 -in downloaded-key-file.p12 -out your-key-file.pem -nodes
You will be asked for the password you received during step 5.
That's it! You now have a service account with an email address and a key that you can use from your Node application.
Replace the keyFile.pem file with the generated file generated in the previous step. Set your data in authData.json.
Then you can run examples.
$ node <example-you-want-to-run>.js