Skip to content

Commit

Permalink
Update doc, add --local-port
Browse files Browse the repository at this point in the history
  • Loading branch information
eliangcs committed Oct 9, 2024
1 parent 265905e commit 60ed166
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 22 deletions.
3 changes: 2 additions & 1 deletion docs/cli.html
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,8 @@ <h2 id="invoke">invoke</h2>
<li><code>-p, --page</code> | Set bundle.meta.page. Only makes sense for a trigger. When used in production, this indicates which page of items you should fetch. First page is 0.</li>
<li><code>--non-interactive</code> | Do not show interactive prompts.</li>
<li><code>-z, --timezone</code> | Set the default timezone for datetime field interpretation. If not set, defaults to America/Chicago, which matches Zapier production behavior. Find the list timezone names at <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">https://en.wikipedia.org/wiki/List_of_tz_database_time_zones</a>. Defaults to <code>America/Chicago</code>.</li>
<li><code>--redirect-uri</code> | The redirect URI that will be passed to the OAuth2 authorization URL. Usually this should match the one configured in your server&apos;s OAuth2 application settings. A local HTTP server will be started to listen for the OAuth2 callback. If your server requires a non-localhost or HTTPS address for the redirect URI, you can set up port forwarding to route the non-localhost or HTTPS address to localhost. Defaults to <code>http://localhost:9000</code>.</li>
<li><code>--redirect-uri</code> | Only used by <code>auth start</code> subcommand. The redirect URI that will be passed to the OAuth2 authorization URL. Usually this should match the one configured in your server&apos;s OAuth2 application settings. A local HTTP server will be started to listen for the OAuth2 callback. If your server requires a non-localhost or HTTPS address for the redirect URI, you can set up port forwarding to route the non-localhost or HTTPS address to localhost. Defaults to <code>http://localhost:9000</code>.</li>
<li><code>--local-port</code> | Only used by <code>auth start</code> subcommand. The local port that will be used to start the local HTTP server to listen for the OAuth2 callback. This port can be different from the one in the redirect URI if you have port forwarding set up. Defaults to <code>9000</code>.</li>
<li><code>-d, --debug</code> | Show extra debugging output.</li>
</ul><p><strong>Examples</strong></p><ul>
<li><code>zapier invoke</code></li>
Expand Down
3 changes: 2 additions & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ The following is a non-exhaustive list of current limitations and may be support
* `-p, --page` | Set bundle.meta.page. Only makes sense for a trigger. When used in production, this indicates which page of items you should fetch. First page is 0.
* `--non-interactive` | Do not show interactive prompts.
* `-z, --timezone` | Set the default timezone for datetime field interpretation. If not set, defaults to America/Chicago, which matches Zapier production behavior. Find the list timezone names at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. Defaults to `America/Chicago`.
* `--redirect-uri` | The redirect URI that will be passed to the OAuth2 authorization URL. Usually this should match the one configured in your server's OAuth2 application settings. A local HTTP server will be started to listen for the OAuth2 callback. If your server requires a non-localhost or HTTPS address for the redirect URI, you can set up port forwarding to route the non-localhost or HTTPS address to localhost. Defaults to `http://localhost:9000`.
* `--redirect-uri` | Only used by `auth start` subcommand. The redirect URI that will be passed to the OAuth2 authorization URL. Usually this should match the one configured in your server's OAuth2 application settings. A local HTTP server will be started to listen for the OAuth2 callback. If your server requires a non-localhost or HTTPS address for the redirect URI, you can set up port forwarding to route the non-localhost or HTTPS address to localhost. Defaults to `http://localhost:9000`.
* `--local-port` | Only used by `auth start` subcommand. The local port that will be used to start the local HTTP server to listen for the OAuth2 callback. This port can be different from the one in the redirect URI if you have port forwarding set up. Defaults to `9000`.
* `-d, --debug` | Show extra debugging output.

**Examples**
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/docs/cli.html
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,8 @@ <h2 id="invoke">invoke</h2>
<li><code>-p, --page</code> | Set bundle.meta.page. Only makes sense for a trigger. When used in production, this indicates which page of items you should fetch. First page is 0.</li>
<li><code>--non-interactive</code> | Do not show interactive prompts.</li>
<li><code>-z, --timezone</code> | Set the default timezone for datetime field interpretation. If not set, defaults to America/Chicago, which matches Zapier production behavior. Find the list timezone names at <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">https://en.wikipedia.org/wiki/List_of_tz_database_time_zones</a>. Defaults to <code>America/Chicago</code>.</li>
<li><code>--redirect-uri</code> | The redirect URI that will be passed to the OAuth2 authorization URL. Usually this should match the one configured in your server&apos;s OAuth2 application settings. A local HTTP server will be started to listen for the OAuth2 callback. If your server requires a non-localhost or HTTPS address for the redirect URI, you can set up port forwarding to route the non-localhost or HTTPS address to localhost. Defaults to <code>http://localhost:9000</code>.</li>
<li><code>--redirect-uri</code> | Only used by <code>auth start</code> subcommand. The redirect URI that will be passed to the OAuth2 authorization URL. Usually this should match the one configured in your server&apos;s OAuth2 application settings. A local HTTP server will be started to listen for the OAuth2 callback. If your server requires a non-localhost or HTTPS address for the redirect URI, you can set up port forwarding to route the non-localhost or HTTPS address to localhost. Defaults to <code>http://localhost:9000</code>.</li>
<li><code>--local-port</code> | Only used by <code>auth start</code> subcommand. The local port that will be used to start the local HTTP server to listen for the OAuth2 callback. This port can be different from the one in the redirect URI if you have port forwarding set up. Defaults to <code>9000</code>.</li>
<li><code>-d, --debug</code> | Show extra debugging output.</li>
</ul><p><strong>Examples</strong></p><ul>
<li><code>zapier invoke</code></li>
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ The following is a non-exhaustive list of current limitations and may be support
* `-p, --page` | Set bundle.meta.page. Only makes sense for a trigger. When used in production, this indicates which page of items you should fetch. First page is 0.
* `--non-interactive` | Do not show interactive prompts.
* `-z, --timezone` | Set the default timezone for datetime field interpretation. If not set, defaults to America/Chicago, which matches Zapier production behavior. Find the list timezone names at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. Defaults to `America/Chicago`.
* `--redirect-uri` | The redirect URI that will be passed to the OAuth2 authorization URL. Usually this should match the one configured in your server's OAuth2 application settings. A local HTTP server will be started to listen for the OAuth2 callback. If your server requires a non-localhost or HTTPS address for the redirect URI, you can set up port forwarding to route the non-localhost or HTTPS address to localhost. Defaults to `http://localhost:9000`.
* `--redirect-uri` | Only used by `auth start` subcommand. The redirect URI that will be passed to the OAuth2 authorization URL. Usually this should match the one configured in your server's OAuth2 application settings. A local HTTP server will be started to listen for the OAuth2 callback. If your server requires a non-localhost or HTTPS address for the redirect URI, you can set up port forwarding to route the non-localhost or HTTPS address to localhost. Defaults to `http://localhost:9000`.
* `--local-port` | Only used by `auth start` subcommand. The local port that will be used to start the local HTTP server to listen for the OAuth2 callback. This port can be different from the one in the redirect URI if you have port forwarding set up. Defaults to `9000`.
* `-d, --debug` | Show extra debugging output.

**Examples**
Expand Down
25 changes: 7 additions & 18 deletions packages/cli/src/oclif/commands/invoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,23 +378,7 @@ class InvokeCommand extends BaseCommand {

async startOAuth2(appDefinition) {
const redirectUri = this.flags['redirect-uri'];
let port;
try {
port = parseInt(new URL(redirectUri).port);
} catch (err) {
throw new Error(
`Invalid redirect URI '${redirectUri}'. ` +
"A valid example would be 'http://localhost:8000'."
);
}
port = parseInt(port);
if (!port) {
throw new Error(
`Could not parse port from redirect URI: '${redirectUri}'. ` +
"A valid example would be 'http://localhost:8000'."
);
}

const port = this.flags['local-port'];
const env = {};

if (!process.env.CLIENT_ID || !process.env.CLIENT_SECRET) {
Expand Down Expand Up @@ -1132,9 +1116,14 @@ InvokeCommand.flags = buildFlags({
}),
'redirect-uri': flags.string({
description:
"The redirect URI that will be passed to the OAuth2 authorization URL. Usually this should match the one configured in your server's OAuth2 application settings. A local HTTP server will be started to listen for the OAuth2 callback. If your server requires a non-localhost or HTTPS address for the redirect URI, you can set up port forwarding to route the non-localhost or HTTPS address to localhost.",
"Only used by `auth start` subcommand. The redirect URI that will be passed to the OAuth2 authorization URL. Usually this should match the one configured in your server's OAuth2 application settings. A local HTTP server will be started to listen for the OAuth2 callback. If your server requires a non-localhost or HTTPS address for the redirect URI, you can set up port forwarding to route the non-localhost or HTTPS address to localhost.",
default: 'http://localhost:9000',
}),
'local-port': flags.integer({
description:
'Only used by `auth start` subcommand. The local port that will be used to start the local HTTP server to listen for the OAuth2 callback. This port can be different from the one in the redirect URI if you have port forwarding set up.',
default: 9000,
}),
},
});

Expand Down

0 comments on commit 60ed166

Please sign in to comment.