genetic-orange
genetic-orange6mo ago

AuthProvider not recognized in @refine/core

AuthProvider not recognized in @refine/core
2 Replies
kapa.ai
kapa.ai6mo ago
Hi @M3HDI. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- It seems like you're trying to import AuthProvider from @refinedev/core, but it's not being recognized. This is because the AuthProvider has been updated in the latest version of Refine and the documentation might not have been updated yet to reflect this change. As per the discussion on Discord (https://discord.com/channels/837692625737613362/1199756403611553882), you should use AuthBindings import from @refinedev/core instead of AuthProvider. Here's how you can do it:
import { AuthBindings } from "@refinedev/core";
import { AuthBindings } from "@refinedev/core";
However, if you want to continue using the authProvider@v3, you can use it as legacyAuthProvider in your project as mentioned in the migration guide (https://refine.dev/docs/migration-guide/auth-provider/#backward-compatibility). Here's how you can do it:
import { LegacyAuthProvider } from "@refinedev/core";

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

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

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

const App = () => {
return (
<Refine
legacyAuthProvider={authProvider}
>
<AppLayout />
</Refine>
);
};
And add v3LegacyAuthProviderCompatible: true to your auth hooks:
import { useLogin } from "@refinedev/core";

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

const login = useLogin({
v3LegacyAuthProviderCompatible: true,
});
Please note that legacyAuthProvider will be removed in the next major version. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai6mo ago
<@751100082274828380> kapa.ai is still learning and improving, please let us know how it did by reacting below