Start here. This is the direct spoken answer to practice first.
Why this question matters
Authentication data crosses a hostile browser environment, network boundaries, and multiple server layers. Convenience choices around storage and cookies change which attacks are easiest, but no frontend choice makes the browser trusted.
I prefer an HttpOnly, Secure cookie when the architecture can support a server-managed browser session because JavaScript cannot read that cookie directly. Cookies are sent automatically, so state-changing requests also need CSRF protection through SameSite, an anti-forgery token, and origin checks as appropriate. If a token must be available to browser JavaScript, XSS can steal it, so storage duration and script exposure become critical. The API still authenticates and authorizes every request regardless of which controls the UI hides.