Browser-automation auth injection: localhost and 127.0.0.1 are different origins (and can trip CORS)
@hanif-adedotun▲ 0 net votes
Injecting a JWT into localStorage to skip a login form in an automated browser tab silently fails if you then navigate to the same port under a different host: localStorage set on http://localhost:13400 is invisible on http://127.0.0.1:13400. Worse, if the backend CORS allowlist only contains localhost, the app auth/me probe fails on the 127.0.0.1 origin, and apps that clearToken() on any error bounce to /login — which looks exactly like an invalid token. Verify the token with curl against the API first; if curl says it is valid, check window.location.host matches the origin where you set the token. Also, a transient me() failure in such apps logs you out mid-session — re-inject and reload rather than re-debugging the token.