|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <title>JSDoc: Source: OAuth2.gs</title> |
| 6 | + |
| 7 | + <script src="scripts/prettify/prettify.js"> </script> |
| 8 | + <script src="scripts/prettify/lang-css.js"> </script> |
| 9 | + <!--[if lt IE 9]> |
| 10 | + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> |
| 11 | + <![endif]--> |
| 12 | + <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> |
| 13 | + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> |
| 14 | +</head> |
| 15 | + |
| 16 | +<body> |
| 17 | + |
| 18 | +<div id="main"> |
| 19 | + |
| 20 | + <h1 class="page-title">Source: OAuth2.gs</h1> |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + <section> |
| 27 | + <article> |
| 28 | + <pre class="prettyprint source linenums"><code>// Copyright 2014 Google Inc. All Rights Reserved. |
| 29 | +// |
| 30 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 31 | +// you may not use this file except in compliance with the License. |
| 32 | +// You may obtain a copy of the License at |
| 33 | +// |
| 34 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 35 | +// |
| 36 | +// Unless required by applicable law or agreed to in writing, software |
| 37 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 38 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 39 | +// See the License for the specific language governing permissions and |
| 40 | +// limitations under the License. |
| 41 | + |
| 42 | +/** |
| 43 | + * @fileoverview Contains the methods exposed by the library, and performs |
| 44 | + * any required setup. |
| 45 | + */ |
| 46 | + |
| 47 | +// Load the Underscore.js library. This library was added using the script |
| 48 | +// ID "1I21uLOwDKdyF3_W_hvh6WXiIKWJWno8yG9lB8lf1VBnZFQ6jAAhyNTRG". |
| 49 | +var _ = Underscore.load(); |
| 50 | + |
| 51 | +/** |
| 52 | + * The supported formats for the returned OAuth2 token. |
| 53 | + * @type {Object.<string, string>} |
| 54 | + */ |
| 55 | +var TOKEN_FORMAT = { |
| 56 | + JSON: 'application/json', |
| 57 | + FORM_URL_ENCODED: 'application/x-www-form-urlencoded' |
| 58 | +}; |
| 59 | + |
| 60 | +/** |
| 61 | + * The supported locations for passing the state parameter. |
| 62 | + * @type {Object.<string, string>} |
| 63 | + */ |
| 64 | +var STATE_PARAMETER_LOCATION = { |
| 65 | + AUTHORIZATION_URL: 'authorization-url', |
| 66 | + REDIRECT_URL: 'redirect-url' |
| 67 | +}; |
| 68 | + |
| 69 | +/** |
| 70 | + * Creates a new OAuth2 service with the name specified. It's usually best to create and |
| 71 | + * configure your service once at the start of your script, and then reference them during |
| 72 | + * the different phases of the authorization flow. |
| 73 | + * @param {string} serviceName The name of the service. |
| 74 | + * @return {Service_} The service object. |
| 75 | + */ |
| 76 | +function createService(serviceName) { |
| 77 | + return new Service_(serviceName); |
| 78 | +} |
| 79 | + |
| 80 | +/** |
| 81 | + * Returns the redirect URI that will be used for a given script. Often this URI |
| 82 | + * needs to be entered into a configuration screen of your OAuth provider. |
| 83 | + * @param {string} scriptID The script ID of your script, which can be found in |
| 84 | + * the Script Editor UI under "File > Project properties". |
| 85 | + * @return {string} The redirect URI. |
| 86 | + */ |
| 87 | +function getRedirectUri(scriptId) { |
| 88 | + return Utilities.formatString('https://script.google.com/macros/d/%s/usercallback', scriptId); |
| 89 | +} |
| 90 | + |
| 91 | +if (typeof module === 'object') { |
| 92 | + module.exports = { |
| 93 | + createService: createService, |
| 94 | + getRedirectUri: getRedirectUri |
| 95 | + }; |
| 96 | +} |
| 97 | +</code></pre> |
| 98 | + </article> |
| 99 | + </section> |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | +</div> |
| 105 | + |
| 106 | +<nav> |
| 107 | + <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Service_.html">Service_</a></li></ul><h3>Global</h3><ul><li><a href="global.html#createService">createService</a></li><li><a href="global.html#getRedirectUri">getRedirectUri</a></li><li><a href="global.html#STATE_PARAMETER_LOCATION">STATE_PARAMETER_LOCATION</a></li><li><a href="global.html#TOKEN_FORMAT">TOKEN_FORMAT</a></li></ul> |
| 108 | +</nav> |
| 109 | + |
| 110 | +<br clear="both"> |
| 111 | + |
| 112 | +<footer> |
| 113 | + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Oct 06 2017 21:26:53 GMT-0400 (EDT) |
| 114 | +</footer> |
| 115 | + |
| 116 | +<script> prettyPrint(); </script> |
| 117 | +<script src="scripts/linenumber.js"> </script> |
| 118 | +</body> |
| 119 | +</html> |
0 commit comments