I'm having an issue with integration with NestJS. I followed the guide in the documentation. But whe...
u
I'm having an issue with integration with NestJS. I followed the guide in the documentation. But whenever I use the guard I get the following error.
Nest can't resolve dependencies of the AuthGuard (?). Please make sure that the argument Object at index [0] is available in the AppModule context.
The constructor for the guard looks like the following:
constructor(private readonly verifyOptions?: VerifySessionOptions)
It seems like the guard is having a DI issue and NestJS can't find it. Any helps on getting me int he right directino would be great.
r
Hey @.auha
@porcellus can help here sometime tomorrow
p
Hi
are you using the guard like this?
u
So after some reading and looking into it. I've been using the guard for the whole app instead of for each route. SInce I was using it that way it was trying to do DI on it, and it didn't work. If I did
@UseGuard(new AuthGuard())
it would work.
@porcellus Do you know how to make the settings for ConfigInjectionToken more persistent? After doing a forRoot with the dynamic module I am not able to use the
SupertokensService
any other module because the DI does not know how to inject
ConfigInjectionToken
config. Do you know how to get that to work?
p
I can look into this a bit more to provide an exact code snippet, but I think you just need to move the provider for
ConfigInjectionToken
to a place where other modules can use it (or possibly set it as an export) not sure, I haven't worked in Nest for a while
38 Views