Custom Sign In | React ref for LoginLink || login() function in NextJS SDK
When using a custom login flow i want to be able to handle the on enter event of the email input field for example to start the auth flow and click the Login Button
I thought I could just use a react ref on the LoginLink component but it does not allow refs in the props (See Image)
The documentation on custom auth has a
login()
function one could use on a button or smthing like that
But the NextJS SDK does not seem to have that function anywhere ?6 Replies
I've used the ref on the parent button now
And click using
But there should be a better solution
Hey, could you explain me further what you mean please by :
When using a custom login flow i want to be able to handle the on enter event of the email input field for example to start the auth flow and click the Login ButtonThere's no login() function in the NextJS SDK. What i find to work is to manually send a request to the api/auth/register or api/auth/login endpoint
I want to handle the on enter event of the Email Input to trigger the login button
Which is a buttone and insdie is the LoginLink Component as children. If LoginLink would allow refs I could easily trigger the button
Can I send the email adress with it to the api endpoint?
Can you share a code snippet please ?
Sry for the late supply
Heres my current working solution:
Instead of having the react ref on the button it would be nice to be able to put it onto the
LoginLink
component. But that doesnt accept React Refs as propsOooh I think I better understand now. I don't see any other way.
You could also have a custom login() function that you will call on the onClick event of the <Button>