flux-login-helper
Helpers for doing the OIDC Authentication Code flow with Flux.io.
Example
var FluxSdk = ;var LoginHelper = ; var sdk = "your_client_id" clientSecret: "your_client_secret" redirectUri: "https://your.app/auth_callback"; /* Somewhere in your app... */ { var helper = sdk; /* Redirect the user to Flux for authentication. */ response; response;} /* Setup the authentication callback route. */app;
Usage
Each instance of LoginHelper is good for one authentication flow (request and response). The static method LoginHelper.OIDCResponseHandler keeps a registry of LoginHelper instances so that the authentication callback is paired with the correct initial request.
Methods
Static methods:
OIDCResponseHandler(request, response) -> Promise(credentials)
: Use this at the/auth_callback
route (or equivalent) in your app to get the authed user's credentials.setLogLevel(level)
: Sets the log level offlux-login-helper
and all its dependencies.
Instance methods:
#getAuthorizeUrl()
: Get a Flux authorization url to which you should redirect the unauthed user.#exchangeCredentials()
: Given a query object containing the parameters of the auth code response from Flux, makes the token request. You should not need to call this directly.#loginLocal() -> Promise(credentials)
: Locally runs a complete auth code flow login. Useful for terminal applications where you expect only one user.