ApexDevelopment / cohost-api

An unofficial tRPC-based wrapper API for Cohost.org
1 stars 0 forks source link

Unable to login to account #1

Open SpiritAxolotl opened 4 months ago

SpiritAxolotl commented 4 months ago

error dump when I try to login:

TRPCClientError: Login Failed
    at TRPCClientError.from (file:///app/node_modules/@trpc/client/dist/TRPCClientError.mjs:26:20)
    at file:///app/node_modules/@trpc/client/dist/links/httpBatchLink.mjs:81:56
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  meta: {
    response: Response {
      status: 400,
      statusText: 'Bad Request',
      headers: Headers {
        connection: 'keep-alive',
        'set-cookie': 'connect.sid=[redacted]; Domain=cohost.org; Path=/; Expires=Mon, 24 Jun 2024 07:37:02 GMT; HttpOnly; Secure; SameSite=Lax',
        'accept-ranges': 'bytes',
        via: '1.1 varnish, 1.1 varnish, 1.1 varnish',
        'content-language': 'en',
        'content-type': 'application/json',
        'access-control-allow-credentials': 'true',
        'x-powered-by': 'Express',
        'cache-control': 'private, max-age=0',
        date: 'Mon, 17 Jun 2024 07:37:02 GMT',
        'x-served-by': 'cache-sjc10076-SJC, cache-sjc10074-SJC, cache-den8259-DEN',
        'x-cache': 'MISS, MISS, MISS',
        'x-cache-hits': '0, 0, 0',
        'x-timer': 'S1718609821.303194,VS0,VE1439',
        vary: 'Origin',
        'strict-transport-security': 'max-age=31557600',
        'alt-svc': 'h3=":443";ma=86400,h3-29=":443";ma=86400,h3-27=":443";ma=86400',
        'transfer-encoding': 'chunked'
      },
      body: ReadableStream { locked: true, state: 'closed', supportsBYOB: true },
      bodyUsed: true,
      ok: false,
      redirected: false,
      type: 'basic',
      url: 'https://cohost.org/api/v1/trpc/login.login?batch=1'
    },
    responseJSON: [ [Object] ]
  },
  shape: {
    message: 'Login Failed',
    code: -32600,
    data: {
      code: 'BAD_REQUEST',
      httpStatus: 400,
      path: 'login.login',
      errorCode: 'login-failed'
    }
  },
  data: {
    code: 'BAD_REQUEST',
    httpStatus: 400,
    path: 'login.login',
    errorCode: 'login-failed'
  },
  [cause]: undefined
}

I'm guessing this has to do with my email or password being wrong somehow? Either way, I don't know where else to get help so I'm asking here.
And if it helps, here's my code.

ApexDevelopment commented 4 months ago

Hm, it's possible the API changed. Thanks for the heads up, I'll try to take a look tomorrow.

Edit: Actually I think you're right, based on the response it looks like the login creds are wrong. Regardless I'll try to add some error handling.