Next-Auth with my own supplied credentials (from a MySQL database)
Hello!
I am creating an application that will be for internal employees. I would like to use Next-Auth for authentication. However for now I have only tried out the standard providers like (Discord, GitHub, Google etc..) For this project I have to use my own credentials. Supplied from a database that I host.
I have tried looking at the web for some examples on how to do this, but im not able to find any good examples. In the docs you get a lot of the code for you, but not the logic for verifying the user/password and getting it from the database. Does anyone have a good example/tutorial for this? That would work in a real life application. I have heard
bcrypt
is good for hashing? π17 Replies
Take a look at blitz auth. I find it easier to wrap my head around what is happening (more declarative api) and how to therefore alter it if needed. Also password auth is the default there: https://blitzjs.com/docs/auth
Bcrypt is good, argon2 is even betterβπΌ
I would recommend to simply create a new starter project with the above blitz toolkit and afterwards take a look at the signing endpoints provided in the starter project for signing up, logging in/out, resetting password, β¦ - that way you get a pretty good overview
Note: you dont have to use the whole toolkit, the auth module is a standalone package* i only recommend to start with a new project to get to see the actual auth code fast so u dont waste your time and get to see their actual implementation.
thanks i will try blitz then π
if anyone see this thread and wanna provide me with more examples, feel free to spit it in π
Unknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View
as i mentioned in my first post here i dont want any third party provider. i wanna host this myself
Unknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View
i have read this of course, but it doesnt show you an example on how you could fetch and login users from your own database. the logic for hashing/dehashing etc
you have to write that yourself, and thats what i need an example of
Unknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View
yes
Unknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View
i know how the process works, i just want to see some example code
Unknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View
Hello, I did this as a project. Feel free to check how I did it to get inspiration!
https://github.com/ruhap/t3-credentials
GitHub
GitHub - ruhap/t3-credentials: t3 stack with next-auth credential p...
t3 stack with next-auth credential provider. Contribute to ruhap/t3-credentials development by creating an account on GitHub.
thanks i'll try it out
Unknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View
Thanks for sharing
Unknown Userβ’3y ago
Message Not Public
Sign In & Join Server To View