useLogin
I'm looking for a headless example of using useLogin. Ideally I want to have a custom login page set up for styling and I'm still trying to work out if it's better to create a form, or use the inferencer.
The example on the useLogin page shows only the Antd version.
https://refine.dev/docs/api-reference/core/hooks/authentication/useLogin/
I'm sure I'm missing something basic but I'm currently switching away from using Google Auth as the auth provider as we'll want more options than just a Gmail account for signups.
useLogin | refine
useLogin data hook from refine is a modified version of react-query's useMutation for authentication.
2 Replies
Hi @h3rrpie. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
You can create a custom login page using the
useLogin
hook without relying on Ant Design. Here's an example of a custom login page using plain HTML and CSS:
This example uses a simple form with username and password fields. When the form is submitted, it calls the onSubmit
function, which retrieves the form data and calls the login
function from the useLogin
hook.
Regarding the choice between creating a form or using the inferencer, it depends on your requirements and preferences. Creating a custom form gives you more control over the styling and behavior, while using the inferencer might save you some time in development.
For more information on the useLogin
hook, you can refer to the useLogin documentation (https://refine.dev/docs/api-reference/core/hooks/auth/useLogin).
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------<@204362818592440323> kapa.ai is still learning and improving, please let us how it did by reacting below