samuelthomas2774 / nxapi

Nintendo Switch Online/Parental Controls app APIs. Show your Nintendo Switch presence in Discord, get friend notifications on desktop, and download and access SplatNet 2, NookLink, SplatNet 3 and Parental Controls data. Mirror of https://gitlab.fancy.org.uk/samuel/nxapi.git.
GNU Affero General Public License v3.0
441 stars 34 forks source link

Error in authentication: 'The provided session_token_code is invalid' #60

Open preon7 opened 1 year ago

preon7 commented 1 year ago

Error encountered when authorizing with the Nintendo Account link. Example error response:


ErrorResponse: [na] Non-200 status code
    from https://accounts.nintendo.com/connect/1.0.0/api/session_token (400 Bad Request)
      { error: 'invalid_request',
        error_description: 'The provided session_token_code is invalid' }
    at getNintendoAccountSessionToken (file:///Users/ruiheng/Documents/splatoon/obs-splat/node_modules/nxapi/dist/api/na.js:25:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.handler (file:///Users/ruiheng/Documents/splatoon/obs-splat/node_modules/nxapi/dist/cli/nso/auth.js:56:19) {
  response: Response {
    size: 0,
    [Symbol(Body internals)]: {
      body: [PassThrough],
      stream: [PassThrough],
      boundary: null,
      disturbed: true,
      error: null
    },
    [Symbol(Response internals)]: {
      type: 'default',
      url: 'https://accounts.nintendo.com/connect/1.0.0/api/session_token',
      status: 400,
      statusText: 'Bad Request',
      headers: [Object],
      counter: 0,
      highWaterMark: 16384
    }
  },
  data: {
    error: 'invalid_request',
    error_description: 'The provided session_token_code is invalid'
  },
  body: '{"error":"invalid_request","error_description":"The provided session_token_code is invalid"}'
}

Solution: replace the app version in na.ts with the latest version (2.5.0 on Apr. 21 2023)

preon7 commented 1 year ago

update: This solution only works on some user. Others still get the same error.