Skip to content

Conversation

@itsbhaumikjoshi
Copy link

Changes accordingly to folder structure:

Server

Earlier Flow

  1. The client checks the access token. If expired or missing, fetch a new access token from the /refresh_token route.
  2. After fetching the access_token the resource is fetched.

Flow Now

  1. The client sends a request for a resource, the server verifies access_token, if unavailable, checks the refresh token, and sends the access token via headers with the resource data.
  1. Upgraded pg library version, now the server can perfectly connect with the ```postgres`` database.
  2. Removed refresh_token route from index.ts file, as passing access tokens through headers is way more efficient and optimized than explicitly requesting them through a route.
  3. Modified isAuth.ts middleware to handle access_token as well as refresh_token. If the access_token is expired, new access_token is generated and sent through the request's headers.
  4. Now, with every request rather than passing userId as payload, entire user details are passed.

Web

  1. Replaced all old apollo packages with one @apollo/client package and removed unused packages.
  2. Added middleware for sending the access_token with the headers with every graphql request and receiving them with the response headers.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant