NhostClientConstructorParams

Parameters


start optional boolean


refreshIntervalTime optional number

Time interval until token refreshes, in seconds


clientStorageType optional ClientStorageType

Define a way to get information about the refresh token and its exipration date.

@default

web


clientStorage optional ClientStorage

Object where the refresh token will be persisted and read locally.

Recommended values:

  • 'web' and 'cookies': no value is required
  • 'react-native': import Storage from @react-native-async-storage/async-storage
  • 'cookies': localStorage
  • 'custom': an object that defines the following methods:
    • setItem or setItemAsync
    • getItem or getItemAsync
    • removeItem
  • 'capacitor': import { Storage } from @capacitor/storage
  • 'expo-secure-store': import * as SecureStore from 'expo-secure-store'
PropertyTypeRequiredNotes
clientStorage.setItem(_key: string, _value: string) => void
clientStorage.getItem(key: string) => any
clientStorage.removeItem(key: string) => void
clientStorage.set(options: { key: string, value: string }) => void
clientStorage.get(options: { key: string }) => any
clientStorage.remove(options: { key: string }) => void
clientStorage.setItemAsync(key: string, value: string) => void
clientStorage.getItemAsync(key: string) => any
clientStorage.deleteItemAsync(key: string) => void
clientStorage.customGet(key: string) => null | string | Promise<null | string>
clientStorage.customSet(key: string, value: null | string) => void | Promise<void>

autoRefreshToken optional boolean

When set to true, will automatically refresh token before it expires


autoSignIn optional boolean

When set to true, will parse the url on startup to check if it contains a refresh token to start the session with


devTools optional boolean

Activate devTools e.g. the ability to connect to the xstate inspector


subdomain optional string

Project subdomain (e.g. ieingiwnginwnfnegqwvdqwdwq) Use localhost during local development


region optional string

Project region (e.g. eu-central-1) Project region is not required during local development (when subdomain is localhost)


authUrl optional string


graphqlUrl optional string


storageUrl optional string


functionsUrl optional string


adminSecret optional string

When set, the admin secret is sent as a header, x-hasura-admin-secret, for all requests to GraphQL, Storage, and Serverless Functions.