documentation of how to handle Authorization
See original GitHub issueStory
I’m want to be able to send user authorization token that can modify the GraphQL context
When using subscriptions-transport-ws I could generate the GraphQL Context using the onConnect helper
https://github.com/sibelius/relay-workshop/blob/master/packages/server/src/index.ts#L30
import { SubscriptionServer } from 'subscriptions-transport-ws';
SubscriptionServer.create(
{
onConnect: async (connectionParams: ConnectionParams) => {
const { user } = await getUser(connectionParams?.authorization);
return getContext({ user });
},
// eslint-disable-next-line
onDisconnect: () => console.log('Client subscription disconnected!'),
execute,
subscribe,
schema,
},
{
server,
path: '/subscriptions',
},
);
When using this package, we need to pass context on server creating that we won’t be able to modify context based on use authorization token
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:31 (16 by maintainers)
Top Results From Across the Web
API authentication and authorization - Idratherbewriting.com
In this section, you'll learn more about authentication and authorization and what you should focus on in documentation.
Read more >Authorization of documents and folders in a process - IBM
You can assign various authorization levels to process documents and folders, depending on the user role for the process instance.
Read more >Authentication vs. Authorization - Auth0
In simple terms, authentication is the process of verifying who a user is, while authorization is the process of verifying what they have...
Read more >Introduction to authorization in ASP.NET Core | Microsoft Learn
Authorization refers to the process that determines what a user is able to do. For example, an administrative user is allowed to create...
Read more >Authorization - HTTP - MDN Web Docs - Mozilla
The HTTP Authorization request header can be used to provide credentials that authenticate a user agent with a server, allowing access to a ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

should this be another recipe?
I personally like performing authorization on every subscription request (in
onSubscribe). In cases where you’re using token based auth, running a check on every operation request guarantees expiry detection or manipulation prevention.