Replies: 2 comments 2 replies
-
I think I figured it out... I changed my import { sessionStorage } from '@/services/session.server';
import { type User } from '@/types';
import { Authenticator } from 'remix-auth';
import { FormStrategy } from 'remix-auth-form';
export const authenticator = new Authenticator<User>(sessionStorage);
authenticator.use(
new FormStrategy(async ({ context }) => {
if (
context &&
'userAccountId' in context &&
typeof context.userAccountId === 'number'
) {
return {
id: context.userAccountId,
};
}
throw new Error('Invalid authentication request');
}),
'user-pass',
); and now I do all validation in |
Beta Was this translation helpful? Give feedback.
2 replies
-
The FormStrategy exists to centralize auth logic into Remix Auth strategies, if you're not using it with the OAuth2Strategy (or a derived strategy) it will be simpler to just do your code in an action. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I don't understand what is the point of
remix-auth-form
.I already use conform to build forms and actions to process data changes.
How do I do something like this in an action?
Beta Was this translation helpful? Give feedback.
All reactions