Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth0Provider does not accept CustomContext made from CustomUser #748

Open
6 tasks done
aki-caffeine opened this issue Mar 7, 2024 · 0 comments
Open
6 tasks done
Labels
bug Something isn't working

Comments

@aki-caffeine
Copy link

Checklist

Description

Since User has been declared as a fixed type, it is no longer possible to set the Context created from Auth0ContextInterface<CustomUser extends user> in the context property of Auth0Provider.

This seems to be caused by merging the pull request below.

https://github.com/auth0/auth0-react/pull/401/files

Reproduction

I want to set the context to CustomUser, which extends User, as shown below, but I get a type error

class CustomUser extends user {
    getSomeInfo : () => {
        ....
    }
}

export const CustomAuth0Provider = ({ children }: { children: React.ReactNode }) => {

    const customContext = createContext<Auth0ContextInterface<CustomUser>>(initialCustomAuthContext);
    return (
        <Auth0Provider
            domain={domain}
            clientId={clientId}
            context={customContext} // Type Error
            authorizationParams={{
                redirect_uri: redirectUri,
                audience: audience,
                scope: "openid profile email",
            }}>
            {children}
        </Auth0Provider>
    );
}

Additional context

No response

auth0-react version

2.2.4

React version

18.2

Which browsers have you tested in?

Chrome

@aki-caffeine aki-caffeine added the bug Something isn't working label Mar 7, 2024
@aki-caffeine aki-caffeine changed the title Auth0Provider is defined User by let Auth0Provider does not accept customContext made from CustomUser Mar 14, 2024
@aki-caffeine aki-caffeine changed the title Auth0Provider does not accept customContext made from CustomUser Auth0Provider does not accept CustomContext made from CustomUser Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant