Strapi 凭证#
您可以使用这些凭证来认证以下节点:
前提条件#
创建一个 Strapi 管理员账户,具备:
- 访问现有 Strapi 项目的权限。
- 该项目中至少有一个集合类型。
- 该集合类型中已发布数据。
有关更多信息,请参考 Strapi 开发者快速入门指南。
支持的认证方法#
- API 用户账户:需要具有适当内容权限的用户账户。
- API 令牌:需要管理员账户。
相关资源#
有关该服务的更多信息,请参考 Strapi 文档。
使用 API 用户账户#
要配置此凭证,您需要:
- 用户 邮箱:必须是用户账户的邮箱,而不是管理员账户。请参考下面的详细说明。
- 用户 密码:必须是用户账户的密码,而不是管理员账户。请参考下面的详细说明。
- URL:使用您 Strapi 服务器的公共 URL,在
./config/server.js
中定义为url
参数。Strapi 建议使用绝对 URL。- 对于 Strapi Cloud 项目,使用您 Cloud 项目的 URL,例如:
https://my-strapi-project-name.strapiapp.com
- 对于 Strapi Cloud 项目,使用您 Cloud 项目的 URL,例如:
- API 版本:选择您希望调用使用的 API 版本。选项包括:
- 版本 3
- 版本 4
在 Strapi 中,配置涉及两个步骤:
有关每个步骤的详细说明,请参考下面的更详细的指导。
Configure a role#
For API access, use the Users & Permissions Plugin in Settings > Users & Permissions Plugin.
Refer to Configuring Users & Permissions Plugin for more information on the plugin. Refer to Configuring end-user roles for more information on roles.
For the n8n credential, the user must have a role that grants them API permissions on the collection type. For the role, you can either:
- Update the default Authenticated role to include the permissions and assign the user to that role. Refer to Configuring role's permissions for more information.
- Create a new role to include the permissions and assign the user to that role. Refer to Creating a new role for more information.
For either option, once you open the role:
- Go to the Permissions section.
- Open the section for the relevant collection type.
- Select the permissions for the collection type that the role should have. Options include:
create
(POST)find
andfindone
(GET)update
(PUT)delete
(DELETE)
- Repeat for all relevant collection types.
- Save the role.
Refer to Endpoints for more information on the permission options.
Create a user account#
Now that you have an appropriate role, create an end-user account and assign the role to it:
- Go to Content Manager > Collection Types > User.
- Select Add new entry.
- Fill in the user details. The n8n credential requires these fields, though your Strapi project may have more custom required fields:
- Username: Required for all Strapi users.
- Email: Enter in Strapi and use as the Email in the n8n credential.
- Password: Enter in Strapi and use as the Password in the n8n credential.
- Role: Select the role you set up in the previous step.
Refer to Managing end-user accounts for more information.
使用 API 令牌#
To configure this credential, you'll need:
-
An API Token: Create an API token from Settings > Global Settings > API Tokens. Refer to Strapi's Creating a new API token documentation for more details and information on regenerating API tokens.
API tokens permission
If you don't see the API tokens option in Global settings, your account doesn't have the API tokens > Read permission.
-
The URL: Use the public URL of your Strapi server, defined in
./config/server.js
as theurl
parameter. Strapi recommends using an absolute URL.- For Strapi Cloud projects, use the URL of your Cloud project, for example:
https://my-strapi-project-name.strapiapp.com
- For Strapi Cloud projects, use the URL of your Cloud project, for example:
- The API Version: Select the version of the API you want your calls to use. Options include:
- Version 3
- Version 4
🚀 与作者交流

📚 教程 💡 案例 🔧 技巧

⚡ 快答 🎯 定制 🚀 支持