This article will be specifically about getting JWT ( Javascript Web Token ) to work with Salesforce API using Java. Parts of these you can use for other things, but the logic is pretty much the same.