login auth
hi all
when someone do a login you save the profile in localStorage and after that if the user try to go to another page you check if you have a profile details in the localStorge (maybe in another storge IDK) and if he logged in then the user can enter the page, otherwise refine will direct it automatically to the loginPage
I want to remove this thing becuse I do this thing in the server side, what things and where I should to do the changes to stop this client side auth ?
thank you
4 Replies
Hi @Deleted User. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To stop client-side authentication in refine, you can remove the
Authenticated
component wrapping your pages. Instead, you can rely on server-side authentication using your authProvider
's check
function.
For example, in a Next.js application, you can remove the Authenticated
component from your pages and use the getServerSideProps
function to handle authentication:
In a Remix application, you can remove the Authenticated
component and use the loader
function to handle authentication:
Remember to remove the Authenticated
component from all the pages you want to handle authentication server-side.
For more information on handling authentication in Next.js and Remix, you can refer to the following documentation:- Next.js Authentication (https://refine.dev/docs/packages/documentation/routers/nextjs#how-to-handle-authentication)
- Remix Authentication (https://refine.dev/docs/packages/documentation/routers/remix#how-to-handle-authentication)
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------Remix | refine
refine provides router bindings and utilities for Remix. This package will provide easy integration between refine and Remix for both existing projects and new projects without giving up the benefits of Remix.
Next.js | refine
refine provides router bindings and utilities for Next.js. This package will provide easy integration between refine and Next.js for both existing projects and new projects without giving up the benefits of Next.js.
<@1073419683014922323> kapa.ai is still learning and improving, please let us how it did by reacting below
extended-yellow•2y ago
you can use
authProvider.onError
function to check server-side authentication.
for example, if api returns 401. you can remove token and check function will redirect to login page
if you want to completely remove to client side chekcs.
you can return success:true on authProvider.check
and after that you need to remove <Authenticated>
component from router implementation. after that you can implement your own authentication logics.
example from tutorial:
you need to remove Authenticated