function getRedirectUri(optScriptId) {
  var scriptId = optScriptId || ScriptApp.getScriptId();
  return 'https://script.google.com/macros/d/' + encodeURIComponent(scriptId) +
    '/usercallback';
}
Returns the redirect URI that will be used for a given script. Often this URI
needs to be entered into a configuration screen of your OAuth provider.
@param {string=} optScriptId The script ID of your script, which can be
    found in the Script Editor UI under "File > Project properties". Defaults
    to the script ID of the script being executed.
@return {string} The redirect URI.