---
agentTools:
  projectIndex: https://docs.xkit.co/llms.txt
---

# First Service Account - Slides

Steps to set up Google Slides Service Account with Xkit

*Google's Guide: <https://developers.google.com/identity/protocols/oauth2/service-account>*
*Authorization protocol: OAuth 2.0*

[block:callout]
{
  "type": "info",
  "title": "User Impersonation tokens",
  "body": "Google Service Accounts allow you to retrieve access tokens for any user in a G Suite / Google Workspace account with user impersonation. To get tokens for a specific user, use the `provider_user_id` query parameter in the [Get User Connection](https://docs.xkit.co/reference/get-user-connection) API call. See [Retrieve user tokens](#retrieve-user-tokens) for more information."
}
[/block]

[block:api-header]
{
  "title": "1. Add the Google Slides Service Account connector in the Xkit platform."
}
[/block]

* In the Xkit platform, click "New connector" in the sidebar.
* Click "Google Slides Service Account".

[block:html]
{
  "html": "<div style=\"margin-left:28px\">\n<video width=\"600px\" style=\"border:1px solid #d6d6d6; padding:4px;\" controls>\n  <source src=\"https://xkit-assets.s3-us-west-2.amazonaws.com/Website/Videos/Google+Service+Accounts+All/GoogleServiceAccountSlides1.mp4\" type=\"video/mp4\">\n  \" Your browser does not support HTML5 video.\n  \"\n  </video>\n</div>\n\n<style></style>"
}
[/block]

[block:api-header]
{
  "title": "2. Create a project in the Google Cloud Platform."
}
[/block]

* Next, in a separate window, visit the [Google Cloud Platform](https://console.cloud.google.com/).
* Hover the cursor over "IAM & Admin" and click on [Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts)
* Click "CREATE PROJECT", enter the name of your application and click "CREATE".

[block:api-header]
{
  "title": "3. Create your Service Account."
}
[/block]

* From the [Google Service Accounts](https://console.cloud.google.com/projectselector2/iam-admin/serviceaccounts) page, click on your project.
* Click "+ Create Service Account" at the top of the page.
* Enter the requested "Service Account Details" and click "Create".
* Continue through the "Service Account Permissions" and then click "Done" on the "Grant Users Access to this Service Account" to create the service account.

[block:html]
{
  "html": "<div style=\"margin-left:28px\">\n<video width=\"600px\" style=\"border:1px solid #d6d6d6; padding:4px;\" controls>\n  <source src=\"https://xkit-assets.s3-us-west-2.amazonaws.com/Website/Videos/Google+Service+Accounts+All/GoogleServiceAccount3.mp4\" type=\"video/mp4\">\n  \" Your browser does not support HTML5 video.\n  \"\n  </video>\n</div>\n\n<style></style>"
}
[/block]

[block:api-header]
{
  "title": "4. Create new key and download JSON file."
}
[/block]

* Click on the recently created service account.
* Scroll down and click on "Add Key" and then "Create new key" to download the JSON file.

[block:html]
{
  "html": "<div style=\"margin-left:28px\">\n<video width=\"600px\" style=\"border:1px solid #d6d6d6; padding:4px;\" controls>\n  <source src=\"https://xkit-assets.s3-us-west-2.amazonaws.com/Website/Videos/Google+Service+Accounts+All/GoogleServiceAccount4.mp4\" type=\"video/mp4\">\n  \" Your browser does not support HTML5 video.\n  \"\n  </video>\n</div>\n\n<style></style>"
}
[/block]

[block:api-header]
{
  "title": "5. Enable the Google Slides API."
}
[/block]

* Use the sidebar to go to the "API & Services" [dashboard](https://console.cloud.google.com/apis/)
* Click "ENABLE APIS AND SERVICES".
* Search "Google Slides" and click on it.
* Click "ENABLE".

[block:html]
{
  "html": "<div style=\"margin-left:28px\">\n<video width=\"600px\" style=\"border:1px solid #d6d6d6; padding:4px;\" controls>\n  <source src=\"https://xkit-assets.s3-us-west-2.amazonaws.com/Website/Videos/Google+Service+Accounts+All/GoogleServiceAccountSlides5.m4v\" type=\"video/mp4\">\n  \" Your browser does not support HTML5 video.\n  \"\n  </video>\n</div>\n\n<style></style>"
}
[/block]

[block:api-header]
{
  "title": "6. Provide Xkit with JSON file and update Service Provider Settings."
}
[/block]

* Return to the Xkit Google Slides Service Account connector page.
* Click "Select File" and upload the downloaded JSON file; the info will populate in the Xkit fields.
* Click "Save" to update the service provider settings.
* Confirm the "Catalog Settings" and click "Save".
* Select the requested Scopes and click "Save".

[block:html]
{
  "html": "<div style=\"margin-left:28px\">\n<video width=\"600px\" style=\"border:1px solid #d6d6d6; padding:4px;\" controls>\n  <source src=\"https://xkit-assets.s3-us-west-2.amazonaws.com/Website/Videos/Google+Service+Accounts+All/GoogleServiceAccount6.mp4\" type=\"video/mp4\">\n  \" Your browser does not support HTML5 video.\n  \"\n  </video>\n</div>\n\n<style></style>"
}
[/block]

**You've now successfully connected Google Slides Service Account with Xkit!**

[block:api-header]
{
  "title": "Retrieve user tokens"
}
[/block]

You'll note that the `https://www.googleapis.com/auth/admin.directory.user.readonly` scope is required in order to use Google Service Accounts.

Supplying this scope gives you read-only access to the [Directory API of the Admin SDK](https://developers.google.com/admin-sdk/directory). In order to retrieve tokens for each individual user in a Google Workspace / G Suite organization, you need to:

1. [Enable the Admin SDK](https://console.developers.google.com/marketplace/product/google/admin.googleapis.com) for your application in the developer console
2. Call the [List Users](https://developers.google.com/admin-sdk/directory/v1/reference/users/list) endpoint to get a list of all users in an organization
3. Use each user's email address in the `provider_user_id` query parameter in the [Get User Connection](https://docs.xkit.co/reference/get-user-connection) API to retrieve an access token for each user

Each individual access token will enable you to impersonate the specific user.