# 通过API生成登录邮件

**URL:** <https://meta.discourse.org/t/generating-a-login-email-via-api/235737>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [2022年八月10日 14:55 UTC](https://meta.discourse.org/t/generating-a-login-email-via-api/235737 "2022-08-10T14:55:20Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2022年八月10日 17:42 UTC](https://meta.discourse.org/t/generating-a-login-email-via-api/235737/4 "2022-08-10T17:42:52Z")

</div>

> [@davidevans](#):
>
> 我收到一个“您将被重定向”的响应，会将我重定向回主页。

该端点目前确实无法用于 API 调用。当您为其传递 API 密钥时，您会在这里重定向：

> <https://github.com/discourse/discourse/blob/2e2fee9da3af7898d38e5a8797d5930d6c26fc03/app/controllers/users_controller.rb#L950>

并且由于此路由受到 `:verify_authenticity_token` CSRF 保护，因此您无法在没有 API 密钥的情况下调用它。

---

_[View the full topic](https://meta.discourse.org/t/generating-a-login-email-via-api/235737)._
