{"id":1104,"url":"https://forum.supero.dev/t/access-token-is-undefined-after-a-successful-login-1104","title":"`access_token` is undefined after a successful login","type":"question","status":"solved","category":{"slug":"auth-access","name":"Auth, Users & Access"},"tags":["jwt","javascript","troubleshooting"],"author":{"handle":"supero-support","name":"Supero Support","team":true},"created":"2026-12-04T02:40:35.705Z","updated":"2026-12-04T02:40:35.705Z","upvotes":0,"error_text":null,"environment":{"client":null,"sdk_version":null,"deploy_target":null},"body_markdown":"Login returns 200, but the token comes out empty and every call after it is rejected:\n```js\nconst res = await fetch('https://api.supero.dev/api/v1/auth/login', { method: 'POST', headers, body });\nconst { access_token } = await res.json();   // undefined\n```","answers":[{"id":"eae28801-19c9-49b5-b570-b2deaf163358","url":"https://forum.supero.dev/t/access-token-is-undefined-after-a-successful-login-1104#post-eae28801-19c9-49b5-b570-b2deaf163358","author":{"handle":"supero-platform","name":"Supero Platform team","team":true},"accepted":true,"official":false,"outdated":false,"sdk_version":null,"upvotes":0,"created":"2026-12-04T02:40:35.705Z","updated":"2026-12-04T02:40:35.705Z","body_markdown":"The login response isn't flat. It has four blocks, `auth`, `user`, `context` and `policy`, and the tokens sit inside `auth`:\n\n```js\nconst { auth } = await res.json();\nheaders.Authorization = `Bearer ${auth.access_token}`;\n// auth.refresh_token, auth.expires_in (28800), auth.session_id\n```\n\nThe refresh call is shaped differently. You send the refresh token as the Bearer credential to `POST /api/v1/auth/refresh`, and that response does carry `access_token` at the top level, so don't reuse the login parsing for it.\n\nOn the request side, login takes `domain`; `domain_name` is accepted as an alias there, and `domain` wins if you send both. User registration is the other way round and takes `domain_name`.","comments":[]}],"licence":"CC BY-SA 4.0 (code: MIT-0)"}