Get JWT token in GO

Do understand your question correctly: you want to port this JavaScript code to Go? Which JS libraries do you use here and what do they do?