useTrixtaAuth

A react hook that will return authentication and authorization info.

import { useTrixtaAuth } from '@trixtateam/trixta-js-core';
const { 
isAuthenticated,
hasRole,
hasAccess,
isAuthorizing 
} = useTrixtaAuth({ roleName });

Options

  • roleName : string?

    • Optional

    • Trixta role name

Returns

  • isAuthenticated : boolean

    • Will be true if the Trixta space connected with token parameter.

  • hasRole : boolean

    • Will be true if the passed roleName for the current user has access.

  • hasAccess : boolean

    • Will be true if the hasRole and isAuthenticated mentioned above is true.

  • isAuthorizing : boolean

    • Will be true if Trixta is still authorizing the above mentioned roleName

Last updated