remotestorage-oauth
This library allows command-line Node programs to obtain an OAuth access token from a remoteStorage server. It does this in one of two ways:
- It opens the OAuth provider site in the user's preferred browser, and launches an HTTP server for the provider to redirect back to, to capture the token
- It launches a text-mode browser in the terminal and accesses the provider site through an HTTP proxy
Usage
Call oauth.authorize()
with the authorization URL, the client ID, the required
scopes, and an options object. The callback is called with an error or a token
response, depending on the result of the authorization request.
var oauth = ; var endpoint = 'https://5apps.com/rs/oauth/jcoglan' client = 'Vault' scopes = 'vault:rw' options = browser: processenvBROWSER inline: processenvINLINE; oauth;
Available options are:
browser
: The name of the web browser executable. Defaults to eitheropen
,xdg-open
, orstart
depending on your OS. This has been tested withelinks
andw3m
.inline
: Set totrue
if you want to run a text-mode browser in the current shell. This option makes the browser access the provider through a local proxy.ca
: A buffer containing a certificate to be used to make HTTPS requests. Required if using theinline
option against a server with a self-signed or other untrusted certificate.