Skip to content

Option to pass Auth0Client instance into Provider #212

@mmakarin

Description

@mmakarin

Describe the problem you'd like to have solved

Right now you can't access Auth0Client instance outside of React.
Valid use case for this is calling logout() from redux-saga or axios (in response to 403 from backend for example).
Another use case is storing token in redux and accessing it in redux-saga/whatever without hacks like this:

  useAsyncEffect(
      async isMounted => {
        const token = await getAccessTokenSilently();      
  
        if (!isMounted) {
          return;
        }
  
        dispatch(updateAuthToken(token));
      },
      [getAccessTokenSilently]
    );

A clear and concise description of what you want to happen.

    const client = new Auth0Client(...);

    render(
        <Auth0Provider client={auth0client}>...<Auth0Provider />
    );

    // Outside of component
    client.logout();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions