Using Magic Link with useAuth() in RW

I have followed instructions from here in my RW app

I then have tried the following

  const {logIn, logOut, isAuthenticated, currentUser} = useAuth()

  ...

  <button onClick={isAuthenticated ? logOut : logIn}>
       {isAuthenticated ? 'Log Out' : 'Log In'}
   </button>

I know magic link is signup Sign in in one click, I tried passing an email to logIn({email:email@email.com}); that sent the email when the page loaded but not on click of the button so something must be wrong about that implementation.

And once I received the email I was able to access my locked down routes, however the isAuthenticated boolean did not switch and show LogOut as the option it was still on login.

Any help for implementation would be great

Thanks ahead of time

@anderskitson please have a look at one of the sample components here playground-auth/MagicLink.js at 14526b26207e6bebdf09ee7f8d4513fbc0707af5 · redwoodjs/playground-auth · GitHub

Which is a playground for the Redwood auth providers.

You can see that it uses signUp with an email but also that these are async and need awaits.

The showUi param will show an intermediate dialog from Magic indicating the request.

Also, make sure your client secrets are correct.