Auth0 Home Blog Docs

The 'sub' claim contained in the token was null - Regular Web App Flow with Spring MVC

I cloned the this repo: https://github.com/auth0-samples/auth0-spring-mvc-sample/tree/master/01-Login

But when I try to login I have the following exception:

This might require some debug effort. It shouldn’t be possible to get a null sub from any ID token in Auth0, I would more likely think that there was either a NULL ID token, or it was trying to parse the access token, which wasn’t a JWT.

A couple of tricks you could do is to try to set a break point and follow through to see whether it is getting an ID token at all. This looks like a pretty old sample, and perhaps it is not including the right method for fetching an ID token and so none is returned when it exchanges the code for tokens.

The other thing to do would be to use developer tools in chrome to look at the request that is sent to Auth0 and make sure it includes the openid scope to ensure that an ID token is returned.

1 Like