Payload offers the ability to Authenticate via JSON Web Tokens (JWT). These can be read from the responses of login, logout, refresh, and me auth operations.
In some cases you may want to prevent the token from being returned from the auth operations. You can do that by setting removeTokenFromResponses to true like so:
When validating Payload-generated JWT tokens in external services, use the processed secret rather than your original secret key:
1
importcryptofrom'node:crypto'
2
3
const secret = crypto
4
.createHash('sha256')
5
.update(process.env.PAYLOAD_SECRET)
6
.digest('hex')
7
.slice(0,32)
Note: Payload processes your secret using SHA-256 hash and takes the first 32 characters. This processed value is what's used for JWT operations, not your original secret.