prisma-archive/graphcool-lib

Parse a Graphcool token

Opened this issue · 1 comments

The generateAuthToken method is great for creating a token given a node id, typename and payload; the reverse method parseAuthToken would be helpful in many use cases as well, for example to automatically connect a created post to the user that made the request.

I now use:

const { projectId, nodeId: userId, modelName } = require('jsonwebtoken').decode(token)

Which is helpful, but not as helpful as a System API mutation that does this, and actually verifies the token, instead of just decoding it.