Skip to content
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

Add example on how to perform authorization when using subscriptions #1694

Merged
merged 1 commit into from
Aug 26, 2021

Conversation

asmeikal
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[x] Docs
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #394

There are no instructions on how to authenticate users when using subscriptions.

What is the new behavior?

Adds a basic example following the Apollo documentation (with links), and instructions on how to add user information to the GraphQL request context (e.g, for guards and decorators). More advanced authentication methods (e.g., via headers) would rely on how subscriptions-transport-ws and its onConnect work, and are out of the scope of NestJS. Adding user information to the context in this cases would be similar.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

I added a warning about the bug of subscriptions-transport-ws that allows connections to be established without going through the onConnect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants