-
Notifications
You must be signed in to change notification settings - Fork 15
mongodb token #9
Comments
Hi @EduardoReolon, yes, it's trying to access database due to this configuration in your
You need to write a mongodb TokenProvider which you need to implement yourself by looking at one of these files: https://github.com/maxgalbu/adonis5-jwt/tree/master/lib/TokenProviders Then edit the config/auth.ts to use the new TokenProvider:
Then import this new TokenProvider here, by adding another else if: https://github.com/maxgalbu/adonis5-jwt/blob/master/providers/JwtProvider.ts#L38-L40 You then need to modify the UserProvider used by the JWT guard, which you can change in
Not an easy task, I can concede |
I can see. I started doing what u just said but waited if there where a easier way. By now I can keep the tokens in a mysql, because these are unrelated to everything else and I still need mysql in the server. Later on I'll try to pull it to mongoDB as well. Thx. |
If you manage to do that, please open a pull request :) |
I made de pull request. Idk if I did everything right. It seams that all worked with Mongo, please check if I haven't messed something up. I couldn't see how to install the dependency in my project from my git (npm i user/adonis5-jwt, but it didn't create build folder). So let me know if you will accept the changes, if not I'll include this folder in my GitHub. Thx. |
You should be able to use your own fork of the library by building it, committing the build folder (not in the pull request branch please 😄 ) and then do something like this: "dependencies" : {
...
"adonis5-jwt": "https://github.com/EduardoReolon/adonis5-jwt.git#yourbranch",
...
} then run |
you can do it with prisma, if you are intended to use mongodb in adonisjs maybe it's the best way.
|
I'm followed this project:
Auth-mongoose-provider
everything worked fine.
but token is still trying to access config/database.ts.
what's the right way of registering the provider for the token?
The text was updated successfully, but these errors were encountered: