import { AuthService } from '@codedevbrad/authservice';
AuthService.initialiseAuthService({
authProvider: 'jwt' ,
app: app ,
path: '/auth' ,
extendModel: {
isAdmin: { type: Boolean } ,
email: { type: String }
},
register: {
type: 'basic',
emailSender: 'codedevbrad@gmail.com'
}
});
AuthService.initialiseJWTProvider({
secret: '12345'
});| perams | options | description |
|---|---|---|
| authProvider | 'jwt' | 'auth0' |
| app | link to | the express() object |
| path | '/auth' | the api path needed to access the auth service |
| extendModel | @object | add additional model fields |
| register | @object | extending how you interact with the register handler |
import { JWTMiddleware } from '@codedevbrad/authservice';
const { authenticateToken , authenticateTokenMiddleware } = JWTMiddleware; import { AuthUser , AuthUserQueries } from '@codedevbrad/authservice';import express , { Application , Request , Response , NextFunction } from 'express';
const app = express();
import { AuthService } from '@codedevbrad/authservice';
AuthService.initialiseAuthService({
authProvider: 'jwt' ,
app: app
});- can't make mongoose queries when the service is imported as an Npm package.
- seems like https://www.npmjs.com/package/parent-require might fix the issue.
- the issue seems to be caused by having mongoose installed in both the parent project and the auth package. I think the issue seems to only crop up when doing npm link.