question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

custom authentication docs are confusing, incomplete and/or incorrect

See original GitHub issue

I am trying to follow the guide here: https://nestjs-admin.com/docs/custom-authentication, for providing custom authentication for the nestjs-admin app. There are a couple of issues with the docs and/or the code that I don’t understand.

FIrst, there is no static method create() on the AdminAuthModuleFactory class. Rather, it’s createAdminAuthModule(), but that method does not allow provisioning a credentialProvider property through the factory as per the docs. The type accepted by that call only allows adminCoreModule, not an instance of AdminAuthModuleConfig.

Second, assuming I could get past the first issue, the CredentialValidatorProvider type does not appear to be exported from nestjs-amin, at least not from the top-level index. So just creating the validator doesn’t work either. Also, the AdminAuthModuleConfig interface is not exported at all, so I’m not sure how that type gets exposed either.

Short of tweaking the credential provider a little I haven’t strayed very far from the docs at all. Is there something I’m missing here? Using version 0.3.0.

Here is the error output:

 TS2345: Argument of type '{ adminCoreModule: { module: typeof AdminCoreModuleFactory; controllers: (typeof DefaultAdminController)[]; providers: (typeof DefaultAdminNunjucksEnvironment | typeof DefaultAdminSite | { ...; } | { ...; } | { ...; })[]; exports: (typeof DefaultAdminNunjucksEnvironment | ... 3 more ... | { ...; })[]; }; credentialP...' is not assignable to parameter of type 'AdminAuthModuleConfig'.
  Object literal may only specify known properties, and 'credentialProvider' does not exist in type 'AdminAuthModuleConfig'.

ERROR in .../src/backoffice/credentialValidator.ts
./src/backoffice/credentialValidator.ts

ERROR in .../src/backoffice/credentialValidator.ts(2,10)
      TS2305: Module '"../../../../../../../Users/lerickson/dev/hospitality/hospitality-api/node_modules/nestjs-admin/dist/src"' has no exported member 'CredentialValidatorProvider'.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
williamdcltcommented, Feb 7, 2020

Thank you @ishpartko for your PR! The docs are indeed somehow outdated, I do realise this is confusing and annoying. I struggle to find the time to maintain this library as well as it deserves, sadly. Hopefully it’ll get better!

0reactions
ishpartkocommented, Feb 6, 2020

@lerickson-control4 good news for us. I have found the sample with using the Validator of admin login. See here: https://github.com/Theodo-UK/nestjs-admin/blob/master/exampleApp/src/user/userCredentialValidator.ts

We mustn’t use the CredentialValidatorProvider in the new way to do this.

This is solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proper way to handle an invalid login attempt on custom module
I've written my custom authentication module by following the examples in the documentation. I have it working, but I've noticed that if a...
Read more >
Creating a custom sign-in page | Identity-Aware Proxy
It lets you customize the entire authentication flow without worrying about the underlying exchanges between the UI and IAP.
Read more >
Gerrit Code Review - Configuration
Gerrit does NOT authenticate the user via LDAP. This authentication type can only be used under hosted daemon mode, and the httpd.listenUrl must...
Read more >
DHS Sensitive Systems Policy Directive 4300A
The Department of Homeland Security (DHS) 4300 series of information security publications are the official documents that articulate ...
Read more >
Ritual Of The Night Has Game-Breaking Bug, Advice Given To ...
After the update, treasure chests will appear in the incorrect open/closed state. ... Or am I a moron and don't under how things...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found