Replies: 5 comments 1 reply
-
Please add a reproduction in order for us to be able to investigate. Depending on the quality of reproduction steps, this issue may be closed if no reproduction is provided. Why was this issue marked with the
|
Beta Was this translation helpful? Give feedback.
-
authenticate: async ({ payload, headers }: AuthStrategyFunctionArgs): Promise<AuthStrategyResult> => {
const cookie = parseCookies(headers),
token = cookie.get('token');
console.log('token', token);
return { user: null }
}; these cookies are available, except in the Working on a sample example project |
Beta Was this translation helpful? Give feedback.
-
The repo is this one: https://github.com/RPdvtPT/payload-strategy-test This is a simple version without OpenID and JWT |
Beta Was this translation helpful? Give feedback.
-
Hey @RPdvtPT — the https://payloadcms.com/docs/hooks/collections#me From the docs:
This effectively allows you to override the logic in the https://github.com/payloadcms/payload/blob/main/packages/payload/src/auth/operations/me.ts You should be able to wire this up accordingly, but as far as how it is behaving now, that would be expected. I will convert this to a discussion to continue to provide help. I bet this will also be useful for others, too! |
Beta Was this translation helpful? Give feedback.
-
Do you have an example of a I've a custom strategy with OpenID using a Cookie JWT, but the Its like the Auth Me Operation ignores this hook ( export const meHook: CollectionMeHook = async ({ args, user }: { args: Arguments, user: any }): Promise<any> => {
const result = {
user,
exp: Math.floor((Date.now() + (6e4 * 60)) / 1000)
}
console.log('meHook', args, user, result);
payload.logger.info('meHook', args, user, result);
return result;
} https://github.com/payloadcms/payload/blob/main/packages/payload/src/auth/operations/me.ts I've tried with Other test was to create an global config endpoint |
Beta Was this translation helpful? Give feedback.
-
Describe the Bug
I'm using a Custom Strategy to login via OpenID without the login form:
This is my auth file:
But the response from
/api/users/me
is this one:With a custom API this also returns
null
in theuser
property:This is the request:
Link to the code that reproduces this issue
https://github.com/RPdvtPT/payload-strategy-test
Reproduction Steps
/api/users/me
responsesWhich area(s) are affected? (Select all that apply)
Not sure
Environment Info
Beta Was this translation helpful? Give feedback.
All reactions