AuthContextProvider

A component to provide the AuthContext to all child components.

// import { useAuthContext } from '@octanner/prism-utilities';
() => {
const SomeComponent = () => {
const context = useAuthContext();
return <div>Status: {context.status}</div>
}
return (
<AuthContextProvider userInfoUri={'/user-info'}>
<SomeComponent />
</AuthContextProvider>
)
};

Props

PropTypeDefaultDescription
childrenReactNodeTypically most of the application.
userInfoUristring | undefinedThe uri to the user-info endpoint, this endpoint must return the accessToken, decodedAccessToken, & permissions. The fe-image hosts this at `{subpath}/oauth/user-info`. `userInfoUri` or `authUserGetter` is required.
authUserGetterIAuthUserInfoGetter | undefinedAn interface that must implement the `getUserInfo` function which returns Promise<AuthUserInfo>. `userInfoUri` or `authUserGetter` is required.