如何在新用户注册时发送电子邮件/触发lambda函数?用户注册时发送电子邮件 - AWS Cognito联合身份验证
在“编辑身份池”下,我只找到一个同步触发器。 如果我理解正确:每次用户同步他的数据时触发这一个...
有没有什么办法只为“初始”同步或为用户创建某个数据集时触发lambda函数?
编辑:
更具体:我确实创造了通过使用JS SDK lambda表达式的用户。我使用我自己的oauth2流进行开发人员身份验证。我不知道如何区分授予访问权限的用户第一次来自有人在第二次这样做。具有访问代码的json对我来说也是一样的......也许我错了。
也使用getOpenIdTokenForDeveloperIdentity
调用我不知道如何区分一个认知的新ID与一个认知已知的ID。
编辑2: 为了更精确: 我建立在这个项目上:https://github.com/laardee/serverless-authentication-boilerplate/blob/master/authentication/lib/storage/usersStorage.js
这里是如何我不保存用户cognito的时刻。 我为第一次使用者以及第n次使用者运行此代码。我的问题是,我不知道如何区分...
const saveCognito = (profile) => new Promise((resolve, reject) => {
if (profile) {
cognitoidentity.getOpenIdTokenForDeveloperIdentity({
IdentityPoolId: process.env.COGNITO_IDENTITY_POOL_ID,
Logins: {
// profile.userId = encrypted id of the e.g. google oauth2 id
[process.env.COGNITO_PROVIDER_NAME]: profile.userId
}
}, (err, dat) => {
if (err) {
reject(err);
} else {
var list_params = {
DatasetName: 'user-data', /* dataset name */
IdentityId: dat.IdentityId, /* cognito id */
IdentityPoolId: process.env.COGNITO_IDENTITY_POOL_ID
};
cognitosync.listRecords(list_params, function(err, data) {
if (err) {
reject(err); // an error occurred
} else {
var RecordPatches = //[Parts of the i want to write to the user]
// SyncSessionToken is returned by the cognitosync.listRecords call
list_params["SyncSessionToken"] = data.SyncSessionToken;
list_params["RecordPatches"] = RecordPatches;
cognitosync.updateRecords(list_params, function(err, update_data) {
if (err){
reject(err);
} else {
resolve();
}
});
}
});
}
});
} else {
reject('Invalid profile');
}
});
我认为实际的用户创建不是lambda表达式? – Erndob
@Erndob看到我的编辑/扩展问题 – Rentrop
要创建的用户,你有一个lambda是将它们添加到池中,它是从登录不同的,你就不能触发电子邮件从你注册拉姆达发送拉姆达? – Erndob