Hrithik.s.raj
05/24/2023, 7:19 AMhttps://cdn.discordapp.com/attachments/644849840475602944/1110829401249173555/image.png▾
yvstrishul
05/24/2023, 7:41 AMtykindsir
05/24/2023, 7:53 AMHimanshuKukreja
05/24/2023, 10:21 AMEvren
05/25/2023, 7:00 AMHHChift
05/25/2023, 10:24 AMjamalabe
05/25/2023, 11:12 AMLuxaaa
05/26/2023, 4:10 AMJimpex
05/26/2023, 5:28 AMmonster7
05/26/2023, 5:51 AMtktom
05/26/2023, 10:03 AMikak
05/26/2023, 11:37 AMn2o
05/26/2023, 11:40 AMnicktgn
05/26/2023, 12:41 PMfront-token
and access-token
, which it returns in the header after sign-in ? Not quite sure what this front-token
is for. Thanks.Kevinkevinkevin
05/26/2023, 3:19 PMKranos
05/26/2023, 6:49 PMamirnoorani
05/26/2023, 10:23 PMdata: { error: 'invalid_grant', error_description: 'Bad Request' }
POST /auth/signinup 500
should I update any of my node codes after updating to core 5.0?Nihil
05/26/2023, 11:28 PMmuhajirdev
05/27/2023, 6:12 AM2023-05-27T06:06:15.831 app[148ed5d7a72e68] sin [info] {"level":50,"time":1685167575831,"pid":529,"hostname":"148ed5d7a72e68","reqId":"req-7k","err":{"type":"Error","message":"SuperTokens core threw an error for a POST request to path: '/recipe/session' with status code: 500 and message: Internal Error\n","stack":"Error: SuperTokens core threw an error for a POST request to path: '/recipe/session' with status code: 500 and message: Internal Error\n\n at Querier.<anonymous> (/app/node_modules/supertokens-node/lib/build/querier.js:252:31)\n at Generator.throw (<anonymous>)\n at rejected (/app/node_modules/supertokens-node/lib/build/querier.js:22:44)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)"},"msg":"SuperTokens core threw an error for a POST request to path: '/recipe/session' with status code: 500 and message: Internal Error\n"}
2023-05-27T06:06:15.832 app[148ed5d7a72e68] sin [info] {"level":30,"time":16
and from supertokens-core
https://cdn.discordapp.com/attachments/644849840475602944/1111899626962948198/message.txtlunis
05/27/2023, 12:08 PMItayElgazar
05/27/2023, 1:03 PMItayElgazar
05/27/2023, 1:04 PMhttps://cdn.discordapp.com/attachments/644849840475602944/1112003297063219301/image.png▾
ItayElgazar
05/27/2023, 1:05 PMKbanman
05/27/2023, 2:02 PMawait session.mergeIntoAccessTokenPayload({ sessionHandle: session.getHandle() });
How can I go about debugging this?Marques
05/27/2023, 5:44 PMLuxaaa
05/28/2023, 6:49 AMSession does not exist
then reloading frontend A after i logged in with the same account in frontend B. Is there a way how i can fix this? I am using the python sdk (fastapi) and for my frontent A the react sdk and for frontend B the web sdk.Kvist
05/28/2023, 9:43 AMhttps://cdn.discordapp.com/attachments/1112315271110209616/1112315273928785940/image.png▾
Dominik John
09/13/2023, 9:59 AMAndrew
10/04/2023, 11:25 PMsalar
04/01/2024, 11:35 PMimport { Controller, Get, Query, Session, UseGuards } from '@nestjs/common';
import { SessionContainer } from 'supertokens-node/recipe/session';
import { BasicAuthGuard } from '../auth/guard/base-auth.guard';
import { GetSubscriptionDetailsRequestDto } from './dto/get-subscription-details.dto';
import { PaymentsService } from './payments.service';
function getUserEmailFromSession(session: SessionContainer) {
const { email } = session.getAccessTokenPayload();
return email;
}
@UseGuards(BasicAuthGuard)
@Controller('payments')
export class PaymentsController {
constructor(private readonly paymentsService: PaymentsService) {}
@Get('details')
public async getSubscriptionDetails(
@Session() session: SessionContainer,
@Query() input: GetSubscriptionDetailsRequestDto,
) {
const subscriptionDetails = await this.getSubscriptionDetailsFromEmail(
getUserEmailFromSession(session),
);
return subscriptionDetails;
}
}
Here's the code for the auth guard
import type { CanActivate, ExecutionContext } from '@nestjs/common';
import { Error as STError } from 'supertokens-node';
import { verifySession } from 'supertokens-node/recipe/session/framework/express';
export class BasicAuthGuard implements CanActivate {
constructor() {}
public async canActivate(context: ExecutionContext): Promise<boolean> {
const ctx = context.switchToHttp();
let err = undefined;
const resp = ctx.getResponse();
// You can create an optional version of this by passing {sessionRequired: false} to verifySession
await verifySession({ checkDatabase: true, sessionRequired: true })(
ctx.getRequest(),
resp,
(res) => {
err = res;
},
);
if (resp.headersSent) {
throw new STError({
message: 'RESPONSE_SENT',
type: 'RESPONSE_SENT',
});
}
if (err) {
throw err;
}
return true;
}
}
This controller runs fine 95% of the time. But we're seeing a weird log on our servers that shouldn't be there.
ALERT!!!! INTERNAL SERVER ERROR!!!
STATUS: 500
METHOD: GET
PATH: /payments/details?checkoutCancelPath=%2Fbilling&checkoutSuccessPath=%2Fbilling&portalReturnPath=%2Fbilling
REQUEST-ID: 492f101b-92e4-4762-8a82-4f131c995c3f
MESSAGE: Cannot read properties of undefined (reading 'getAccessTokenPayload')
ERROR: 'Unhandled Rejection'
STACK: TypeError: Cannot read properties of undefined (reading 'getAccessTokenPayload')
at PaymentsService.getUserEmailFromSession (/app/dist/modules/payments/payments.service.js:187:35)
at PaymentsController.getSubscriptionDetails (/app/dist/modules/payments/payments.controller.js:27:37)
at /app/node_modules/@nestjs/core/router/router-execution-context.js:38:29
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/node_modules/@nestjs/core/router/router-execution-context.js:46:28
at async /app/node_modules/@nestjs/core/router/router-proxy.js:9:17
And I have no clue as to what is happening on the FE that's causing this. We've been unable to identify which user is having this issue. The authentication method is cookies, the access token is sent in the 'cookie' header.
I would really appreciate if anyone can give insights into why we're getting a session
that's undefined
. In my limited knowledge, if the cookie header is not present the BasicAuthGuard should already throw a 401, and I've tested this manually and it is indeed the case.
What escapes me is how can a request pass through the auth guard successfully and end up having a session that is undefined
Thanks allot!