Generate JWT token for service account programmatically

Have you seen this earlier question?