Skip to content

Commit

Permalink
1.35.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Koleda committed Oct 1, 2019
1 parent 7fb414e commit 8c1963e
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 6 deletions.
14 changes: 14 additions & 0 deletions dist/OAuth2.gs
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,20 @@ Service_.prototype.getAccessToken = function() {
return token.access_token;
};

/**
* Gets an id token for this service. This token can be used in HTTP
* requests to the service's endpoint. This method will throw an error if the
* user's access was not granted or has expired.
* @return {string} An id token.
*/
Service_.prototype.getIdToken = function() {
if (!this.hasAccess()) {
throw new Error('Access not granted or expired.');
}
var token = this.getToken();
return token.id_token;
};

/**
* Resets the service, removing access and requiring the service to be
* re-authorized.
Expand Down
107 changes: 106 additions & 1 deletion docs/Service_.html
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,111 @@ <h5>Returns:</h5>



<h4 class="name" id="getIdToken"><span class="type-signature"></span>getIdToken<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>






<div class="description">
Gets an id token for this service. This token can be used in HTTP
requests to the service's endpoint. This method will throw an error if the
user's access was not granted or has expired.
</div>













<dl class="details">
































</dl>













<h5>Returns:</h5>


<div class="param-desc">
An id token.
</div>



<dl>
<dt>
Type
</dt>
<dd>

<span class="param-type">string</span>


</dd>
</dl>













<h4 class="name" id="getLastError"><span class="type-signature"></span>getLastError<span class="signature">()</span><span class="type-signature"> &rarr; {Exception}</span></h4>


Expand Down Expand Up @@ -4975,7 +5080,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Service_.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Sep 04 2019 15:46:04 GMT-0400 (EDT)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Oct 01 2019 13:52:47 GMT-0400 (EDT)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/Storage_.html
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Service_.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Sep 04 2019 15:46:04 GMT-0400 (EDT)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Oct 01 2019 13:52:47 GMT-0400 (EDT)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Service_.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Sep 04 2019 15:46:04 GMT-0400 (EDT)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Oct 01 2019 13:52:47 GMT-0400 (EDT)
</footer>

<script> prettyPrint(); </script>
Expand Down
16 changes: 15 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ <h3> </h3>
expire. This library uses Apps Script's
<a href="https://developers.google.com/apps-script/reference/script/state-token-builder">StateTokenBuilder</a>
and <code>/usercallback</code> endpoint to handle the redirects.</p>
<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
to use this library at all. Apps Script has a number of easy-to-use,
<a href="https://developers.google.com/apps-script/reference/calendar/">built-in services</a>, as well as a variety of
<a href="https://developers.google.com/apps-script/advanced/admin-sdk-directory">advanced services</a> that wrap existing Google REST APIs.</p>
<p>Even if your API is not covered by either, you can still use Apps Script to
obtain the OAuth2 token for you. Simply
<a href="https://developers.google.com/apps-script/concepts/manifests#editing_a_manifest">edit the script's manifest</a> to
<a href="https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes">include the additional scopes</a> that your API requires.
When the user authorizes your script they will also be asked to approve those
additional scopes. Then use the method <a href="https://developers.google.com/apps-script/reference/script/script-app#getoauthtoken"><code>ScriptApp.getOAuthToken()</code></a>
in your code to access the OAuth2 access token the script has acquired and pass
it in the <code>Authorization</code> header of a <code>UrlFetchApp.fetch()</code> call.</p>
<p>Visit the sample <a href="samples/NoLibrary"><code>NoLibrary</code></a> to see an example of how this
can be done.</p>
<h2>Setup</h2><p>This library is already published as an Apps Script, making it easy to include
in your project. To add it to your script, do the following in the Apps Script
code editor:</p>
Expand Down Expand Up @@ -691,7 +705,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Service_.
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Sep 04 2019 15:46:04 GMT-0400 (EDT)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Oct 01 2019 13:52:47 GMT-0400 (EDT)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apps-script-oauth2",
"version": "1.34.0",
"version": "1.35.0",
"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.",
"repository": {
"type": "git",
Expand Down

0 comments on commit 8c1963e

Please sign in to comment.