{"repo":"googleworkspace/apps-script-oauth2","free":true,"listed":false,"github":"https://github.com/googleworkspace/apps-script-oauth2","clone":"git clone https://github.com/googleworkspace/apps-script-oauth2.git","description":"An OAuth2 library for Google Apps Script.","language":"JavaScript","stars":1743,"topics":["oauth","google-apps-script","gsuite","apps-script","google-workspace"],"license":"Apache-2.0","category":"auth-billing-email","readme_excerpt":"OAuth2 for Apps Script is a library for Google Apps Script that provides the ability to create and authorize OAuth2 tokens as well as refresh them when they expire. This library uses Apps Script's StateTokenBuilder and /usercallback endpoint to handle the redirects. Connecting to a Google API If you are trying to connect to a Google API from Apps Script you might not need to use this library at all. Apps Script has a number of easy-to-use, [built-in services][built in], as well as a variety of [advanced services][advanced] that wrap existing Google REST APIs. Even if your API is not covered by either, you can still use Apps Script to obtain the OAuth2 token for you. Simply [edit the script's manifest][edit manifest] to [include the additional scopes][additional scopes] that your API requires. When the user authorizes your script they will also be asked to approve those additional scopes. Then use the method [ ScriptApp.getOAuthToken() ][scriptapp] in your code to access the OAuth2 access token the script has acquired and pass it in the Authorization header of a UrlFetchApp.fetch() call. Visit the sample NoLibrary to see an example of how this can be done. [built in]: https://developers.google.com/apps-script/reference/calendar/ [advanced]: https://developers.google.com/apps-script/advanced/admin-sdk-directory [edit manifest]: https://developers.google.com/apps-script/concepts/manifests#editing a manifest [additional scopes]: https://developers.google.com/apps-script/concepts/","default_branch":null,"files":null,"tree":[],"storefront":"/r/googleworkspace","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/googleworkspace/apps-script-oauth2/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}