Open getFrontend opened 4 months ago
It still didn't work for me
It still didn't work for me
Check first if you have a connection to the database and if a message appears in the console?
@Pheeleex what worked for me was logging the information I received from google
adrian used profile.name for the user name but the data received from the profile had no name for me it was given_name so I used that instead and it worked for me also make sure the schema matched the User.create e.g in the schema I used userName but I used username in the username in the User.create
@getFrontend yeah, it shows mongoDb is connected on my terminal and the user appears in my mongoDB collection, i just keep getting a not permitted to sign in error each time i try.
@Onunkwor okay, I'll try that.
Guys, if you are facing "Access Denied Issue" problem, now I am going to write you 100% solution to the problem 99% of the time. I came to the solution of this problem by re-reading all previous posts and trying all the tips, which in the end did not help, until I found this solution.
1) So, the first thing to do is to make sure that the connection to the database is actually being made and the following message appears in the console "MongoDB successfully conected".
Don't listen to advice like "rename callbacks to callback". This is absolutely wrong advice! According to the documentation it should be "callbacks".
It also doesn't matter whether you have commented outdated rules or not
2) And now the most important thing! In user.js Adrian made essentially unnecessary login validation "Username invalid, it should contain 8-20 alphanumeric letters and be unique!", because we just substitute a ready-made login from Google instead of entering it manually. Because of this, the error occurred, because the login could contain characters, for example for Ukrainian - Cyrillic, or be shorter than 8 characters, or longer than 20.
Just remove this unnecessary validation, and everything will work at once! Good luck!
P.S. Suppose you want to leave the validation, and add for example Cyrillic characters, then you will need this template:
/^(?=.{3,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._\u0400-\u04FF]+(?<![_.])$/