genetic-orange
genetic-orange7mo ago

a fresh install of refine complains "@refinedev/core"' has no exported member named 'AuthProvider'.

the AuthProvider export is missing from node_modules/refinedev/core/src/index.tsx which is very weird. "@refinedev/core": "^4.46.2", in package.json
3 Replies
kapa.ai
kapa.ai7mo ago
Hi @SuperPower. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The issue you're experiencing might be due to the recent changes in Refine's AuthProvider. In the migration from version 3.x.x to 4.x.x, the AuthProvider interface was changed to AuthBindings [source (https://github.com/refinedev/refine/issues/5529)]. However, for backward compatibility, Refine still supports the authProvider@v3 under the name legacyAuthProvider [source (https://refine.dev/docs/migration-guide/auth-provider#backward-compatibility)]. If you want to continue using the authProvider@v3, you can use it as legacyAuthProvider in your project. Here's how you can do it:
// import { AuthProvider } from "@refinedev/core";
import { LegacyAuthProvider } from "@refinedev/core";

// const authProvider: AuthProvider = {/* ... */}
const authProvider: LegacyAuthProvider = {/* ... */}

const App = () => {
return (
<Refine
// authProvider={authProvider}
legacyAuthProvider={authProvider}
>
<AppLayout />
</Refine>
);
};
// import { AuthProvider } from "@refinedev/core";
import { LegacyAuthProvider } from "@refinedev/core";

// const authProvider: AuthProvider = {/* ... */}
const authProvider: LegacyAuthProvider = {/* ... */}

const App = () => {
return (
<Refine
// authProvider={authProvider}
legacyAuthProvider={authProvider}
>
<AppLayout />
</Refine>
);
};
Additionally, you need to add v3LegacyAuthProviderCompatible: true to your auth hooks in order to continue using authProvider@v3 in your project.
import { useLogin } from "@refinedev/core";

const login = useLogin({
v3LegacyAuthProviderCompatible: true,
});
import { useLogin } from "@refinedev/core";

const login = useLogin({
v3LegacyAuthProviderCompatible: true,
});
If you're still facing issues, it might be helpful to check if there are any discrepancies in your package.json dependencies. Make sure all your refine dependencies are updated to the latest version [source (https://github.com/refinedev/refine/issues/2183)]. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai7mo ago
<@219898323941720064> kapa.ai is still learning and improving, please let us know how it did by reacting below
other-emerald
other-emerald7mo ago
Hello @SuperPower, you can use AuthBindings import from @refinedev/core. We have an open PR here, where we update the documentation to use AuthProvider, but it's not released yet. Sorry for the confusion. https://github.com/refinedev/refine/pull/5514
GitHub
ci(changesets): version packages by refine-bot · Pull Request #5514...
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not read...