listen-for

Spin up a transient HTTP server and, once received, print the given [query] from the URL to stdout This is particularly useful in an OAuth pipeline.

Usage no npm install needed!

<script type="module">
  import listenFor from 'https://cdn.skypack.dev/listen-for';
</script>

README

Overview

listen-for <query>

Spin up a transient HTTP server and, once received, print the given [query] from
the URL to stdout

Options:
  --version      Show version number                                   [boolean]
  -p, --port     The port to listen on                  [number] [default: 5000]
  -v, --verbose  show some logs that may be helpful   [boolean] [default: false]
  --help         Show help                                             [boolean]

Install

npm i -g listen-for

Example

run this:

listen-for message

visit: http://localhost:5000?message=Wow!%20That%20was%20remarkably%20satisfying"

finally, check your console ✨

Why

I wanted something I could slip into a shell based oauth pipeline!

# open the /authorize URL in a browser with the right params
code="$(listen-for code)"
# curl the acccess_token endpoint with `code`