'As we send bearer token to backend in each request to server after login and results are return if token is valid, how this works in next-auth

I am using credentials type Provider of next auth , I am checking the user validation from a backend server using external api. Now my question is that, as in normal cases the JWT is sent by server to frontend as session token, and that token is used by client for each request as its proof of being valid and authorised. In next-auth system this JWT is returned by next-auth itself but not the actual backend server. So how server will identify who the user actaully is and also how server will check if the jwt is valid or not as its generated during login by next-auth but not server



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source