wp-graphql-headless-login icon indicating copy to clipboard operation
wp-graphql-headless-login copied to clipboard

Add role to cookie information

Open martinowren opened this issue 1 year ago • 1 comments

What problem does this address?

In an application, we want to have a secure route but do not want to fetch the user data on each route change

What is your proposed solution?

Add role to the cookie information

What alternatives have you considered?

No response

Additional Context

No response

martinowren avatar Feb 13 '25 09:02 martinowren

Hey @martinowren - thanks for this suggestion!

Can you elaborate on what you're looking to achieve / how you would handle this in traditional WordPress?

Our ::set_auth_cookie() function mimics traditional WordPress's wp_set_auth_cookie(), which means we can use the set_auth_cookie action hook to create an additional cookie with whatever information you want.

I know that WordPress expects their cookies to be a specific shape, so I'm not entirely sure how one would go about adding additional information to those without breaking things, but maybe with some more information I could narrow down a solution that also translates to headless.

justlevine avatar Feb 13 '25 10:02 justlevine

Hey @martinowren I'm going to close this for now, please feel free to reply with the above, and I'll go ahead and reopen.

justlevine avatar May 24 '25 21:05 justlevine