The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

500545 (2) [Avatar] Offline
Hi John,

I facing some issues with getting the authentication service to validate the access token. It seems to work just fine with spring-boot-starter-parent version 1.4.4 RELEASE & Camden.SR5. But fails to work with version 1.5.6 RELEASE & Dalston.SR2.

It specifically breaks at this point in the code

	@RequestMapping(value = { "/user" }, produces = "application/json")
	public Map<String, Object> user(OAuth2Authentication user) {
		Map<String, Object> userInfo = new HashMap<>();
		userInfo.put("user", user.getUserAuthentication().getPrincipal());
		userInfo.put("authorities", AuthorityUtils.authorityListToSet(user.getUserAuthentication().getAuthorities()));
		return userInfo;

the user object is always null if I work the version 1.5.6. Any ideas on what could be the reason?

500545 (2) [Avatar] Offline
Found the fix for this. from 1.4 to 1.5 the order of the oAuth filteR was changed from 3 to 1. This is causing the user object to be null. The fix for this is to add the following line to your file


Adding this fixed the issue for me. Hope this helps others.
557010 (1) [Avatar] Offline
Thanks for the fix. I couldn't figure out what was wrong with my code. You saved my day!