-
-
Notifications
You must be signed in to change notification settings - Fork 916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User context docs update #2846
User context docs update #2846
Conversation
@@ -28,3 +28,20 @@ public class Query : ObjectGraphType | |||
} | |||
} | |||
``` | |||
|
|||
If you need to access the User from the http request and populate this globally, you will need to add a User property to your custom `UserContext` class and modify your Startup configuration as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
populate this globally
What does globally mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for catching this, adjusted the wording and added the other changes suggested.
@@ -28,3 +28,20 @@ public class Query : ObjectGraphType | |||
} | |||
} | |||
``` | |||
|
|||
If you need to access the User from the http request and populate this globally, you will need to add a User property to your custom `UserContext` class and modify your Startup configuration as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you will need to add a User property
or just
var context = new MyGraphQLUserContext(); // or even Dictionary<string, object?>();
context["User"] = user;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I would change wording from will need to to may.
} | ||
|
||
services.AddGraphQL() | ||
.AddUserContextBuilder(httpContext => new MyGraphQLUserContext(httpContext.User)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no such method in this repo. It's method from server project. Worth to note explicitly.
@Shane32 Merge if OK. |
No description provided.