Search code examples
reactjsreact-admin

react-admin: what is authParams for?


I am using react-admin and I am looking at the documentation page for creating page with permissions

The example shows:

const MyPageWithPermissions = ({ location, match }) => (
    <WithPermissions
        authParams={{ key: match.path, params: route.params }}
        // location is not required but it will trigger a new permissions check if specified when it changes
        location={location}
        render={({ permissions }) => <MyPage permissions={permissions} /> }
    />
);

export default MyPageWithPermissions;

First of all:

  • route is not defined, what is the real value?

I would like to know:

  • What is authParams used for? Is it required or optional?
  • Could authParams be skipped?
  • If it's required, why is it not set automatically directly in WithPermissions Component?

Solution

  • Those are for custom params you'd like to check in your authProvider. They will be passed to it when WithPermissions calls it.

    They are optional though as you can see in the next example for a custom menu