Gives a proper exception if token is invalid
Makes it possible to define required groups in settings for authentication to succeed
Merge branch 'invalid_token_error'