Mazino
Mazino

Reputation: 356

Strapi returns error code 400 on user registration

Strapi user registration returns error 400 Bad Request every time I try to register a test user, however the user does get created in the Users collection.

I am using the standard Strapi Email plugin (not the Send grid plugin), everytime I register a user, this plugin does not send an email which leads to be unable to confirm the user.

strapi returns error code 400 on registering users

In the above image it returns an 400 Error but the user gets created. Also, how to send the confirmation email with Strapi standard email plugin.

All auth permissions for Public role have been enabled

Permissions

How to fix this error and send the confirmation email on new user register?

Upvotes: 4

Views: 3079

Answers (5)

Jhsu
Jhsu

Reputation: 13

Late to this thread but I found the answer in my troubleshooting. For starters, here's some info on how I was running Strapi:

I was getting a 400 error when trying to register a user, but didn't get "Bad Request", my response was "ApplicationError". The user also ended up being made, but no confirmation email was sent.

Turning off confirmation email is one way to resolve the issue, but if you have that turned on then let's assume disabling it isn't a viable option. The secret was that I had to go into Settings > Email templates and set the shipper name, shipper email, and response email to the address I verified in Sendgrid. That's all it took!

Upvotes: 0

user21288752
user21288752

Reputation: 1

I think you are using the wrong endpoint. try with: http://localhost:1337/api/auth/local/register

Upvotes: 0

Doğuş Deniz
Doğuş Deniz

Reputation: 65

please check

enter image description here

enter image description here

My problem was because the sender email was misidentified.

The other problem I had was because there was no email configuration.

I installed the strapi-provider-email-smtp package and it was fixed when I made the necessary settings.

this worked for me.

Upvotes: 0

Anuj Divkar
Anuj Divkar

Reputation: 272

I think it's because you use the default email provider (sendmail). And your computer is not an available smtp server.

So I suggest you to install strapi-email-nodemailer https://www.npmjs.com/package/strapi-email-nodemailer

Then in your admin panel, got to Plugins (menu link) > Email (cog icon) and the select nodemailer provider and set the smtp server you want to use.

If you have trouble to setup correct information I suggest you to check how nodemailer node module work. strapi-email-provider is just a connector to use nodemailer from Strapi.

Upvotes: 0

Chris Fradejas
Chris Fradejas

Reputation: 21

I also have the same issue, I just turned off the 'Enable email confirmation' on Advanced Settings, then it worked (registration).

So, In Strapi Admin:

Go to Settings -> Advanced settings

Set the field Enable email confirmation to "Off" then click save.

This works for me.

Upvotes: 2

Related Questions