Example Springboot Application for Securing a REST API with JSON Web Token (JWT). For an example Integration with Angular (version 2+) go to https://github.com/ipassynk/angular-springboot-jwt
i believe that you can ref to the readme.md file, use curl to test first, then use ur java code to test.
the body should be urlencoded format instead of jason
I am using http://testjwtclientid:XY7kmzoNzl100@localhost:9999/oauth/token url and send { "password":"jwtpass ", "username":"john.doe", "grant_type":"password" } as a body.
Following is my java code.
String url = protocol + clientId + ":" + clientSecret + "@" + url + "/oauth/token"; restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
But it gave me 401 always.