Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Auth plugin question #670

Unanswered
smolinari asked this question in Q&A
Nov 27, 2021 · 1 comments · 1 reply
Discussion options

Hey,

in the docs for the Auth plugin, there is this code.

app.register(mercuriusAuth, {
 // Load the permissions into the context from the request headers
 authContext (context) {
 const permissions = context.reply.request.headers['x-user'] || ''
 return { permissions }
 },

What is meant by and how are the permissions added to the request headers?

Scott

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

This is a good question. The way I usually implement this is by getting the information from a JWT token. I think a more comprehensive example/blog post/tutorial is in order.

You must be logged in to vote
1 reply
Comment options

For sure. Hey, if you know the user permissions are going to be fairly extensive, would you still put them into the JWT? I'm planning to cache the permissions per user as they log in, because the permissions could get hefty, even per user.

Scott

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /