Skip to content

Instantly share code, notes, and snippets.

View NinjaOnRails's full-sized avatar

Danny NinjaOnRails

View GitHub Profile
@neil-gebbie-smarterley
neil-gebbie-smarterley / apolloServer.js
Last active December 19, 2020 17:02
Apollo client, apollo server, next js with cookies
const typeDefs = require('./schema/schema')
const someRestAPI = require('./someRestAPI')
const resolvers = require('./resolvers')
const apolloServer = {
typeDefs,
resolvers,
dataSources: () => ({
someRestAPI: new someRestAPI(),
}),
@soulmachine
soulmachine / jwt-expiration.md
Last active April 10, 2025 12:28
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

@tomysmile
tomysmile / mac-setup-redis.md
Last active May 5, 2025 13:06
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis