我修改了“重置密码”的电子邮件模板。如果用户超出 Identity Planform 的租户范围 - 该模板可以正常工作。但是当用户位于租户范围内时 - 模板不起作用。
用户超出范围:
IDP: https://i.stack.imgur.com/CNO8S.png https://i.stack.imgur.com/CNO8S.png
Email: https://i.stack.imgur.com/7B4ra.png https://i.stack.imgur.com/7B4ra.png
租户范围内的用户:
IDP: https://i.stack.imgur.com/Q42EP.png https://i.stack.imgur.com/Q42EP.png
Email: https://i.stack.imgur.com/6dB6o.png https://i.stack.imgur.com/6dB6o.png
export const resetPassword = (email) => async (dispatch) => {
try {
const userSnapshot = await firebase.db.collection(USER_DATA_COLLECTION).where('email', '==', email).get();
firebase.auth.tenantId = userSnapshot.docs[0].data().tenantId;
return await firebase.doResetPassword(email);
} catch (e) {
console.log(e);
}
};
目前,Google Cloud Identity Platform (GCIP) 和 Firebase Auth 不支持租户特定的电子邮件模板。
您可以更新租户元数据以允许租户继承自定义域、电子邮件模板和自定义 SMTP 设置。如果emailSendingConfig https://cloud.google.com/identity-platform/docs/reference/rest/v2/projects.tenants#inheritance被设定为true
租户发送的电子邮件将遵循项目级别的电子邮件发送配置。如果false
(默认情况下),电子邮件将采用默认设置,不进行任何自定义(例如,不会应用附加到电子邮件模板的自定义域)。您可以通过执行以下 cURL 命令来设置此字段:
curl -d "{'inheritance':{'emailSendingConfig': true}}"\
-H 'Authorization: Bearer AUTH_TOKEN' \
-X PATCH -H 'Content-Type:application/json' \
https://identitytoolkit.googleapis.com/v2/projects/PROJECT_ID/tenants/TENANT_ID?updateMask=inheritance.emailSendingConfig
传递给上述 cURL 命令的参数的注释
The AUTH_TOKEN
将需要列出的范围身份工具包 REST API 文档 https://cloud.google.com/identity-platform/docs/reference/rest/v2/projects.tenants/patch。检索 REST 的身份验证令牌的更简单方法之一
命令是让项目所有者使用OAuth游乐场 https://developers.google.com/oauthplayground/并授权
这Identity Toolkit API v3 范围
TENANT_ID
是实际的租户 ID,而不是显示名称,可以通过以下方式获取GCIP > Tenant
云控制台页面。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)