yolen
01/16/2019, 10:46 AMfoo using the prisma service. Right now foo use a token generated using prisma token. Since the token expires I need to renew the token. I consider setting up a service renewing the token every x minutes. I that the way to do it or are there other way?marcus
01/16/2019, 10:58 AMyolen
01/16/2019, 10:58 AMyolen
01/16/2019, 11:30 AMmarcus
01/16/2019, 11:38 AMyolen
01/16/2019, 11:50 AMyolen
01/16/2019, 11:50 AMmarcus
01/16/2019, 12:00 PMyolen
01/16/2019, 12:02 PMmarcus
01/16/2019, 12:03 PMmarcus
01/16/2019, 12:04 PMyolen
01/16/2019, 12:09 PMyolen
01/16/2019, 12:10 PMpip install pyjwtyolen
01/16/2019, 12:11 PMimport jwt
happy_token = jwt.encode({}, <PRISMA_SECRET>, algorithm='HS256')yolen
01/16/2019, 12:11 PMyolen
01/16/2019, 12:17 PMFran Dios
01/16/2019, 12:25 PMsecret: ${env:PRISMA_SECRET} (same variable). Apart from that, in the Service Docker I specify managementApiSecret with the same value. Does this sound right?
However, I havenāt used prisma token command at all. This secret was generated with openssl rand or similar š¤marcus
01/16/2019, 12:30 PMprisma token in this case because the bindings are already doing that for you internally. @yolen had to do that because we donāt have an official client for Python yet.
2. You can use the same secret for managementApiSecret if you want to. However i would recommend to use something different. This secret protects your management API which is called by prisma deploy. You donāt need to put that secret somewhere else. It is automatically picked up by the Prisma CLI.Fran Dios
01/16/2019, 12:41 PMIt is automatically picked up by the Prisma CLII see! Thatās the part that confused me, I thought it had to be the same because otherwise CLI wouldnāt know. Thanks a lot @marcus
nikolasburk
Fran Dios
01/16/2019, 12:49 PMyolen
01/16/2019, 12:52 PM@classmethod
def _get_prisma_token(cls):
PRISMA_SECRET = os.environ['PRISMA_SECRET']
prisma_token = jwt.encode({}, PRISMA_SECRET, algorithm='HS256').decode('utf-8')
return prisma_tokenyolen
01/16/2019, 12:52 PM