Function AuthContextProvider

  • <AuthContextProvider /> is a React Component that provides the context for the useAuth() hook to be used by components further down your component tree. It should only be included in your component tree once and ideally at the root of the application.

    Example

    import * as React from 'react'
    import { AuthContextProvider, useAuth } from '@oneblink/apps-react'

    function Component() {
    const auth = useAuth()
    // use auth here
    }

    function App() {
    return (
    <AuthContextProvider>
    <Component />
    </AuthContextProvider>
    )
    }

    const root = document.getElementById('root')
    if (root) {
    ReactDOM.render(<App />, root)
    }

    Parameters

    • props: {
          children: ReactNode;
          formsKeyToken?: string;
          userToken?: string;
      }
      • children: ReactNode

        Your application components

      • Optional formsKeyToken?: string

        A Forms Key token being used to make requests to the OneBlink API on behalf of the user

      • Optional userToken?: string

        An encrypted user token that will be used included in the submission on behalf of the user

    Returns Element