#sign in
2 messages · Page 1 of 1 (latest)
Yes, it is possible to sign in without using the React hook useAuthActions, but the recommended and documented approach for Convex Auth in React is to use useAuthActions, which provides the signIn and signOut methods in a convenient way for React components.
However, if you want to sign in programmatically (for example, outside of React components or hooks), you can directly call the underlying API endpoint or action that handles sign-in. According to a Discord support thread, for password authentication, you can call the sign-in endpoint yourself and get the token and refresh token back. The relevant server-side function is exposed at api.auth.signIn, which you can invoke directly from your client or backend logic, bypassing the React hook layer. This is particularly useful for migration scripts or backend flows, but you should be aware of the security implications and token handling requirements in such cases.
Here’s a relevant quote:
but for password, sure you can just call the endpoints yourself and get the token and the refresh token back. What are you going to do with these though?
... you can call the action that signIn calls directly too
that’s exposed at api.auth.signIn
Discord support thread