powerhouse-inc / switchboard

Open-source API over the document model made to be developer- and analyst-friendly
https://switchboard-boilerplate.vercel.app
GNU Affero General Public License v3.0
3 stars 3 forks source link

Share auth with graphql playground #45

Closed valiafetisov closed 1 year ago

valiafetisov commented 1 year ago

Goal

User logged in to the frontend, doesn't need to execute signUp query or set proper headers to run queries

Context

Since auth frontend was implemented in https://github.com/makerdao-ses/switchboard-boilerplate/pull/38, we want to improve UX of the playground users and do not require them to run additional queries there. Technically that would (I imagine) also check for token in cookies IF authorization header is not provided and add the cookie after the signIn/signUp is executed.

Tasks

KirillDogadin-std commented 1 year ago

Well, my ongoing thought process then will start in the direction of the question

"How to set the authorization header in playground through iframe and the playground's api?"

So far i did not find the acceptable way of passing the authorization header to the playground middleware.

KirillDogadin-std commented 1 year ago

Seems like the auth header is already saved in the cookie header, so no setting is needed, so we just want to extract it and use in the middleware as a preset one.