#/me endpoint not returning user.

1 messages · Page 1 of 1 (latest)

desert whale
#

I've seen https://github.com/payloadcms/payload/discussions/10253
But I'm still not sure how I can return the user along with the /me endpoint when using custom strategy?
{"user":null,"message":"Account"}
Using oAuth: https://github.com/WilsonLe/payload-oauth2/blob/main/examples/google.ts

GitHub

Describe the Bug I'm using a Custom Strategy to login via OpenID without the login form: This is my auth file: import { type Payload, PayloadHandler, PayloadRequest, User, parseCookies, AuthStr...

GitHub

Plugin for PayloadCMS to integrate OAuth2. Contribute to WilsonLe/payload-oauth2 development by creating an account on GitHub.

desert whale
#

Not sure if anyone has any examples
Of doing this?

desert whale
solemn gazelle
#

Ive seen most of these awhile ago, suggest you comment on the github project if you want advice for those.

#

But if you look at issues he's implementation doesn't work

#

😂 😂

desert whale
#

Oh really, where you seeing that

solemn gazelle
#

Goto the issue section and read his own notes.

desert whale
#

You got any recommendations on other oauth plugins?

solemn gazelle
#

Why, the article I gave you basically gives you the building block to create your own.

desert whale
#

Not sure if that issue is related to populating user info tho. Seems to be a reoccurring question. Not sure if it needs to be placed in after Me hook

desert whale
solemn gazelle
#

😂 😂 If you actually look at my auth strategy on the site I have alot more but it follows the exact same similar flow.

desert whale
#

Can you make a plugin please 😂 nah jokes, so just to be sure, you’re basically plucking the user id from the jwt and doing a findbyid right?

solemn gazelle
#

I did mention on discord you'll probably be able to find it if you đo a search, the implementation I have is alot more complex. What I've written is secure to be used.

#

No

#

I the oauth calls the endpoint gets the token exchanges it verifies in the strategy creates a session based on verified. Jwt is to sign the payload token to assign it to the user cookies.

#

I've commented almost every line on the article.

desert whale
#

Oh okay so the session is responsible for grabbing user data ?

#

Appreciate it.

solemn gazelle
#

On the session is create to ensure the user is logged in

desert whale
#

I’m a bit lost mate, so what obtains user data when calling. /me?

solemn gazelle
#

The cookie that was created.

#

I think you're basing your integration on an integration where the guy who wrote it up specifically says he needs to add session auth into his implementation.

#

And I can see that's missing from the github.