FluxSdk
Instance methods:
Static methods and properties:
Instance Methods
constructor: FluxSdk(clientId, options)
Arguments
clientId(String): The client ID provided to you when you created your app.options(Object ={ redirectUri: String, clientSecret: String, fluxUrl: String)redirectUri: The URL that the user should be sent to by Flux after authorizing your app. This should be a URL that you specified when creating your app.clientSecret: The client secret provided to you when you created your app. The client secret is required for Node apps, but SHOULD NOT be passed to browser apps!fluxUrl: Use to override the base Flux URL, e.g., for testing purposes
getAuthorizeUrl(state, nonce, [options])
Arguments
state(String): A secure (i.e., unique and non-guessable) string. If you would like to maintain any state throughout the auth process, such as an internal path that the user should be redirected to later, it should be encoded into the state.nonce(String): A secure string.options(Object ={ redirectUri: String })redirectUri: This will override theredirectUrispecified in theconstructor.Note: The
redirectUriingetAuthorizeUrlmust match theredirectUriinexchangeCredentials
Returns
(String) The URL that the user should be sent to in order to authorize your app.
exchangeCredentials(state, nonce, urlQuery, [options])
Arguments
state(String): A secure string. This should match thestatepassed togetAuthorizeUrlnonce(String): A secure string. This should match thenoncepassed togetAuthorizeUrlresponseQuery(Object ={ code: String, state: String, flux_token: String })The response from the Flux server when the user is redirected after authenticating your app.
Node: These should come from the query params
Browser: This is handled for you!
options(Object ={ redirectUri: String })redirectUri: This will override theredirectUrispecified in theconstructor. Note: TheredirectUriinexchangeCredentialsmust match theredirectUriingetAuthorizeUrl
Returns
Promise --> (Credentials) Validated credentials that can be used to make subsequent requests on behalf of a user.
The credentials should be stored somewhere, such as in the app's session storage
if you are writing a Node e.g., Express) server or in the browser's
localStorage if you are writing a browser app.
getUser(credentials)
See User#constructor
sdk.getUser(credentials) is equivalent to new User(credentials)
Static Methods and Properties
User(credentials) (constructor)
See User#constructor
Project(credentials, id) (constructor)
See Project
DataTable(credentials, id) (constructor)
Cell(credentials, dataTableId, id) (constructor)
See Cell#constructor
Constants
TODO