You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and <code>/usercallback</code> endpoint to handle the redirects.</p>
51
+
<h2>Connecting to a Google API</h2><p>If you are trying to connect to a Google API from Apps Script you might not need
52
+
to use this library at all. Apps Script has a number of easy-to-use,
53
+
<ahref="https://developers.google.com/apps-script/reference/calendar/">built-in services</a>, as well as a variety of
54
+
<ahref="https://developers.google.com/apps-script/advanced/admin-sdk-directory">advanced services</a> that wrap existing Google REST APIs.</p>
55
+
<p>Even if your API is not covered by either, you can still use Apps Script to
56
+
obtain the OAuth2 token for you. Simply
57
+
<ahref="https://developers.google.com/apps-script/concepts/manifests#editing_a_manifest">edit the script's manifest</a> to
58
+
<ahref="https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes">include the additional scopes</a> that your API requires.
59
+
When the user authorizes your script they will also be asked to approve those
60
+
additional scopes. Then use the method <ahref="https://developers.google.com/apps-script/reference/script/script-app#getoauthtoken"><code>ScriptApp.getOAuthToken()</code></a>
61
+
in your code to access the OAuth2 access token the script has acquired and pass
62
+
it in the <code>Authorization</code> header of a <code>UrlFetchApp.fetch()</code> call.</p>
63
+
<p>Visit the sample <ahref="samples/NoLibrary"><code>NoLibrary</code></a> to see an example of how this
64
+
can be done.</p>
51
65
<h2>Setup</h2><p>This library is already published as an Apps Script, making it easy to include
52
66
in your project. To add it to your script, do the following in the Apps Script
Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "apps-script-oauth2",
3
-
"version": "1.34.0",
3
+
"version": "1.35.0",
4
4
"description": "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.",
0 commit comments