How to get user information after REST authentication on client side?
<p>I have Spring REST backend and Angular frontend.</p>

<p>Authentication is performed using a POST request to "/login" URL with username and password inside request JSON body (I use form based authentication).
REST backend replies with OK code. Everything is fine and I can perform other requests from frontend that requires authentication.</p>

<p>But frontend need to know what is the role of authenticated user so that it can display a proper view/rote for it. And where can we get this role on a frontend? The only response we got from authentication was OK and that is fine for REST.</p>

<p>We can get user information by performing GET request to "/users/[user_id]". But we don't have user id, just user name.</p>

<p>So the question is - <strong>what is a correct way for REST to get role (or other user information) from frontend having just user name?</strong></p>

<p>As a workaround I can create new request on a backend that takes user name instead of id, or I can add user id to authentication response. But I'm not really sure that is a correct way from REST perspective.</p>