@cori-risi/cori.data.api / AmplifyContextProvider

AmplifyContextProvider()

AmplifyContextProvider(props): Element

This component provides the configuration context to an Amplify/React app, which is particularly useful to one that requires authentication in order to access the CORI Data API. Other than the children prop, the parameters are AWS Cognito values that are passed so that the Amplify configuration method can use the specified User pool and Identity pool to authenticate users (including the cori-risi-public user).

import { AmplifyContextProvider } from "@cori-risi/cori.data.api";

// ...

<AmplifyContextProvider domain={import.meta.env.VITE_COGNITO_DOMAIN}
                        region={import.meta.env.VITE_REGION}
                        identityPoolId={import.meta.env.VITE_IDENTITY_POOL_ID}
                        userPoolId={import.meta.env.VITE_USER_POOL_ID}
                        userPoolClientId={import.meta.env.VITE_USER_POOL_CLIENT_ID} >
    <App />
</AmplifyContextProvider>

Parameters

props

props.children?: ReactElement<any, any> | ReactElement<any, any>[]

props.domain?: string

s- domain for the Cognito Hosted UI and/or OAuth 2.0 endpoints

props.identityPoolId?: string

Cognito Identity pool ID

props.region?: string

AWS region where Cognito service is hosted

props.userPoolClientId?: string

ACognito User pool App client ID (App clients are the user pool authentication resources attached to your app).

props.userPoolId?: string

Cognito User pool ID

Returns

Element

Defined in

@cori-risi/contexts/AmplifyContextProvider.tsx:73