小编Nou*_*our的帖子

在 python 中使用 Lambda 触发器将用户迁移到 Cognito

我在 Python 中创建了一个 Lambda 函数来将用户从 RDS 迁移到 AWS Cognito。我面临的问题是我的函数的返回类型,以便 Cognito 创建用户。起初我返回JSON:

return {
        "response": {
            "userAttributes": {
                "email": event["userName"],
            },
            "finalUserStatus": "CONFIRMED",
            "messageAction": "SUPPRESS",
            "desiredDeliveryMediums": "EMAIL",
            "forceAliasCreation": "false"
        }
    }
Run Code Online (Sandbox Code Playgroud)

这导致了异常: 在此处输入图片说明

我还尝试遵循他们提供的有关通过 Lambda 迁移用户的唯一代码示例(第 109 页):

exports.handler = function (event, context) {
if (event.triggerSource == "UserMigration_Authentication") {
    // authenticate the user with your existing user directory service
    var user = authenticateUser(event.userName, event.request.password);
    if (user) {
        event.response.userAttributes = {
            "email": user.emailAddress,
            "email_verified": "true"
        };
        event.response.finalUserStatus = "CONFIRMED";
        event.response.messageAction = …
Run Code Online (Sandbox Code Playgroud)

python-2.7 amazon-cognito aws-lambda

7
推荐指数
1
解决办法
2894
查看次数

如何在 Xcode 中添加 Spotify 的 URL 方案?

我正在使用 Spotify iOS SDK,我按照官方页面上的教程进行操作,一切都很好,直到我尝试提交到 iTunes connect 进行测试,但出现错误,提示 URL 方案无效。这是我最初在 pllist 中的内容:

spotify-action://
Run Code Online (Sandbox Code Playgroud)

然后我改成

spotify-action
Run Code Online (Sandbox Code Playgroud)

这允许我提交到 itunes connect,但登录流程被破坏 - 当我单击登录时,没有任何反应。没有错误,没有警告。

如果我将“://”添加到 URL 方案中,Spotify 应用程序将启动并正确进行身份验证

这是我用来登录的功能:

func openLoginPage() {
    let auth = SPTAuth.defaultInstance()
    if SPTAuth.supportsApplicationAuthentication() {
        guard let url = auth?.spotifyAppAuthenticationURL() else { return }
        if #available(iOS 10.0, *) {
            if(!UIApplication.shared.openURL(auth!.spotifyAppAuthenticationURL())){
                self.showAlertL(message: "Link won't work for some reason", link: url)
            }
            else{
                print("This works - start screen");
                print(schemeAvailable(scheme: "\(url)"))
            }
            print("This is the URL For Spotify ios 10 \(String(describing: auth?.spotifyAppAuthenticationURL()))")
        } else …
Run Code Online (Sandbox Code Playgroud)

xcode url-scheme spotify ios

5
推荐指数
0
解决办法
879
查看次数