首页 > 解决方案 > Strapi 在用户注册时返回错误代码 400

问题描述

每次我尝试注册测试用户时,Strapi 用户注册都会返回错误 400 Bad Request,但是用户确实会在 Users 集合中创建。

我使用的是标准的 Strapi 电子邮件插件(不是发送网格插件),每次注册用户时,此插件都不会发送电子邮件,导致无法确认用户。

Strapi 在注册用户时返回错误代码 400

在上图中,它返回 400 错误,但用户已创建。此外,如何使用 Strapi 标准电子邮件插件发送确认电子邮件。

Public role已启用所有身份验证权限

权限

如何修复此错误并在新用户注册时发送确认电子邮件?

标签: strapi

解决方案


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.


推荐阅读