1

I’ve spent several hours scouring forums about how I can avoid the dreaded Your token is invalid. It might have expired or you might be using a token from a different project., but to no avail.

My setup:

  • Using prisma generate to make a Prisma client and connect it with
  • graphql-yoga Prisma service running on Heroku
  • Prisma service is pointed to an Amazon RDS instance

This setup works when I’m not using the secret property in my prisma.yml. However, when I add something like secret: mysecret and prisma deploy the service, then use something like prisma playground to play with the service, I get the above error. This also happens when I manually generate a token using prisma token and use it in an HTTP Authorization header.

What am I missing to make this work?

freedomflyer
  • 2,431
  • 3
  • 26
  • 38
  • I am learning Prisma and Graphql, so no expert. I use node. I use the prisma-binding library. I also added the secret there. I added a reference of prisma into the context of the GraphqlServer. When you add the secret option to prisma.yml, I don't think you can connect to the prisma server directly by the playground. You need to start up the GraphqlServer (graphql-yoga). And use the playground there (default is localhost:4000) – Karlan Nov 06 '19 at 16:08

1 Answers1

0

Make sure that you add the secret to your environment variables. E.g. via a .env file:

PRISMA_SECRET="mysecret"

When running prisma cli commands make sure to first set the environment variables. E.g. via something like dotenv:

dotenv -- prisma admin

For more information check out: https://www.prisma.io/docs/prisma-server/authentication-and-security-kke4/#prisma-services

realAlexBarge
  • 1,808
  • 12
  • 19