---
title: "How to Use Service Accounts and OAuth2 in Google Apps Script"
author: "Martin Hawksey"
date: 2021-09-08T18:45:26+00:00
modified: 2021-09-08T18:47:02+00:00
canonical_url: https://pulse.appsscript.info/p/2021/09/how-to-use-service-accounts-and-oauth2-in-google-apps-script/
markdown_url: https://pulse.appsscript.info/p/2021/09/how-to-use-service-accounts-and-oauth2-in-google-apps-script.md
categories:
  - "Intermediate"
  - "Solutions"
  - "V8"
tags:
  - "@wildhogsm"
  - "dmitry-kostyuk"
  - "Medium"
featured_image: https://pulse.appsscript.info/files/2021/09/1WvSIWPzsAqvAyYGi9b3B0A.png
description: "A useful post to find out more about service accounts and how to use them with Google Apps Script. The tutorial put together by Dmitry Kostyuk includes example code for using a service accounts with Firestore, BigQuery and the Admin Directory API."
---

# How to Use Service Accounts and OAuth2 in Google Apps Script

![How to Use Service Accounts and OAuth2 in Google Apps Script](https://pulse.appsscript.info/files/2021/09/1WvSIWPzsAqvAyYGi9b3B0A.png)

> [https://medium.com/geekculture/how-to-use-service-accounts-and-oauth2-in-google-apps-script-99c4bc91dc31](https://medium.com/geekculture/how-to-use-service-accounts-and-oauth2-in-google-apps-script-99c4bc91dc31)Image: Dmitry Kostyuk
> Give your scripts privileges that your users don’t have … In 99% of all cases, authorizations in Google Apps Script are extremely straightforward. When a user executes their script, they run it as themselves with their respective authorization scopes. … However, what if you need to give more rights to your app beyond what your intended users will have? … This is where service accounts come in.

A useful post to find out more about service accounts and how to use them with Google Apps Script. The tutorial put together by Dmitry Kostyuk includes example code for using a service accounts with Firestore, BigQuery and the Admin Directory API.

Source: *[How to Use Service Accounts and OAuth2 in Google Apps Script*](https://medium.com/geekculture/how-to-use-service-accounts-and-oauth2-in-google-apps-script-99c4bc91dc31)

---

*Published by [Martin Hawksey](https://pulse.appsscript.info/p/author/admin/) on [Pulse](https://pulse.appsscript.info/). Original article: [https://pulse.appsscript.info/p/2021/09/how-to-use-service-accounts-and-oauth2-in-google-apps-script/](https://pulse.appsscript.info/p/2021/09/how-to-use-service-accounts-and-oauth2-in-google-apps-script/)*
