On another question... is it possible to create th...
# troubleshoot
g
On another question... is it possible to create the first Personal Access Token programatically?! Thanks a lot!
b
if you're able to specify the DATAHUB_TOKEN_SERVICE_SIGNING_KEY when bringing up datahub, then yes you can programmatically create your own with pyjwt (if you know the structure of the payload)
g
Great to know! do you have any material I could read about it? Thanks a lot!
b
roughly,
Copy code
import jwt
import time

secret = DATAHUB_TOKEN_SERVICE_SIGNING_KEY
payload = {
'actorType': 'USER',
'actorId': 'datahub',
'type': 'PERSONAL',
'version': '1',
'exp': int(time.time())+600,
'jti': '1',
'sub':'datahub',
'iss': 'datahub-metadata-service'
}
token = jwt.encode(payload, secret, algorithm='HS256')
should result in a token that last for 10min for
datahub
user you can check payload by decoding an existing token
g
Thanks a lot! I think I got it (=