Local API Login Documention Incorrect
Documentation Issue
In the Local API login documentation https://payloadcms.com/docs/local-api/overview#login is shows req and res as options however the type for the option doesn't have res (which is needed to auto set the cookie)
export type Options<TSlug extends CollectionSlug> = {
collection: TSlug;
context?: RequestContext;
data: AuthOperationsFromCollectionSlug<TSlug>['login'];
depth?: number;
fallbackLocale?: string;
locale?: string;
overrideAccess?: boolean;
req?: PayloadRequest;
showHiddenFields?: boolean;
};
Also on a side note I would have thought using Server Actions would be the best option but I'm not sure you have access to req and res in server actions, so is auto setting the cookies only going to work on a api route and if you're using server action you'd need to handle setting the cookie yourself?
thank you , you saved me a day
Still facing that issue. res does not exist on context, and there is no documentation whatsoever on how to actually manually set a cookie anywhere. In my case I made a custom graphql resolver that uses the localAPI login. I can't set the cookie as I can't get access to res.
Same problem here, using the Local API login function, and there is no res on it...
🚀 This is included in version v3.24.0
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.